Part Number Hot Search : 
621100A 55C10 CM6903AG XC2V2000 BC846BDW E13005D 66A35 SFA20PJE
Product Description
Full Text Search
 

To Download SH7641 Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  revision date: se p . 14 , 2005 32 hardware manual renesas 32-bit risc microcomputer superh? risc engine family / SH7641 series SH7641 hd6417641 rev.4.00 rej09b0023-0400 SH7641
rev. 4.00 sep. 14, 2005 page ii of l
rev. 4.00 sep. 14, 2005 page iii of l 1. these materials are intended as a reference to assist our customers in the selection of the renesas technology corp. product best suited to the customer's application; they do not convey any license under any intellectual property rights, or any other rights, belonging to renesas technology corp. or a third party. 2. renesas technology corp. assumes no responsibility for any damage, or infringement of any third- party's rights, originating in the use of any product data, diagrams, charts, programs, algorithms, or circuit application examples contained in these materials. 3. all information contained in these materials, including product data, diagrams, charts, programs and algorithms represents information on products at the time of publication of these materials, and are subject to change by renesas technology corp. without notice due to product improvements or other reasons. it is therefore recommended that customers contact renesas technology corp. or an authorized renesas technology corp. product distributor for the latest product information before purchasing a product listed herein. the information described here may contain technical inaccuracies or typographical errors. renesas technology corp. assumes no responsibility for any damage, liability, or other loss rising from these inaccuracies or errors. please also pay attention to information published by renesas technology corp. by various means, including the renesas technology corp. semiconductor home page (http://www.renesas.com). 4. when using any or all of the information contained in these materials, including product data, diagrams, charts, programs, and algorithms, please be sure to evaluate all information as a total system before making a final decision on the applicability of the information and products. renesas technology corp. assumes no responsibility for any damage, liability or other loss resulting from the information contained herein. 5. renesas technology corp. semiconductors are not designed or manufactured for use in a device or system that is used under circumstances in which human life is potentially at stake. please contact renesas technology corp. or an authorized renesas technology corp. product distributor when considering the use of a product contained herein for any specific purposes, such as apparatus or systems for transportation, vehicular, medical, aerospace, nuclear, or undersea repeater use. 6. the prior written approval of renesas technology corp. is necessary to reprint or reproduce in whole or in part these materials. 7. if these products or technologies are subject to the japanese export control restrictions, they must be exported under a license from the japanese government and cannot be imported into a country other than the approved destination. any diversion or reexport contrary to the export control laws and regulations of japan and/or the country of destination is prohibited. 8. please contact renesas technology corp. for further details on these materials or the products contained therein. 1. renesas technology corp. puts the maximum effort into making semiconductor products better and more reliable, but there is always the possibility that trouble may occur with them. trouble with semiconductors may lead to personal injury, fire or property damage. remember to give due consideration to safety when making your circuit designs, with appropriate measures such as (i) placement of substitutive, auxiliary circuits, (ii) use of nonflammable material or (iii) prevention against any malfunction or mishap. keep safety first in your circuit designs! notes regarding these materials
rev. 4.00 sep. 14, 2005 page iv of l general precautions on handling of product 1. treatment of nc pins note: do not connect anything to the nc pins. the nc (not connected) pins are either not connected to any of the internal circuitry or are used as test pins or to reduce noise. if something is connected to the nc pins, the operation of the lsi is not guaranteed. 2. treatment of unused input pins note: fix all unused input pins to high or low level. generally, the input pins of cmos products are high-impedance input pins. if unused pins are in their open states, intermediate levels are induced by noise in the vicinity, a pass- through current flows internally, and a malfunction may occur. 3. processing before initialization note: when power is first supplied, the product's state is undefined. the states of internal circuits are undefined until full power is supplied throughout the chip and a low level is input on the reset pi n. during the period where the states are undefined, the register settings and the output state of each pin are also undefined. design your system so that it does not malfunction because of processing while it is in this undefined state. for those products which have a reset function, reset the lsi immediately after the power supply has been turned on. 4. prohibition of access to undefined or reserved addresses note: access to undefined or reserved addresses is prohibited. the undefined or reserved addresses may be used to expand functions, or test registers may have been be allocated to these addresse s. do not access these registers; the system's operation is not guaranteed if they are accessed. 5. treatment of power supply (0 v) pins note: there should be no voltage difference between the system ground pins (0 v power supply), vssq, vss, vss, v ss (pll1), and vss (pll2). if voltage difference is created between the system ground pins, malfunctions may occur or excessive current flows during standby due to through current. voltage difference should not be created between the system ground pins , vssq, vss, vss (pll1), and vss (pll2).
rev. 4.00 sep. 14, 2005 page v of l important notice on the quality assurance for this lsi although the wafer process and assembly process of this lsi are entrusted to the external silicon foundries, the quality of this ls i is guaranteed for the customers under the quality assurance system of our company. however, if it is clear that our company is responsible for a defective product, we will only offer, after the agreement of both parties, to exchange it with a new product from stock. the following shows the robustness (reference values ) of the lsi against static-electricity-induced breakdown. robustness (reference values) of the lsi against static-el ectricity-induced breakdown machine model method 200 v or more human body model method 1500 v or more charged device model method 1000 v or more for the details on the quality assurance of this ls i, contact your nearest renesas technology sales representative.
rev. 4.00 sep. 14, 2005 page vi of l configuration of this manual this manual comprises the following items: 1. general precautions on handling of product 2. configuration of this manual 3. preface 4. contents 5. overview 6. description of functional modules ? cpu and system-control modules ? on-chip peripheral modules the configuration of the functional description of each module differs according to the module. however, the generic style includes the following items: i) feature ii) input/output pin iii) register description iv) operation v) usage note when designing an application system that includes this lsi, take notes into account. each section includes notes in relation to the descriptions given, and usage notes are given, as required, as the final part of each section. 7. list of registers 8. electrical characteristics 9. appendix 10. main revisions and additions in this edition (only for revised versions) the list of revisions is a summary of points that have been revised or added to earlier versions. this does not include all of the revised contents . for details, see the actual locations in this manual. 11. index
rev. 4.00 sep. 14, 2005 page vii of l
rev. 4.00 sep. 14, 2005 page viii of l preface the SH7641 risc (reduced instruction set computer) microcomputer includes a renesas technology original risc cpu as its core, and the peripheral functions required to configure a system. target users: this manual was written for users who will be using this lsi in the design of application systems. user s of this manual are expected to understand the fundamentals of electrical circuits, logical circuits, and microcomputers. objective: this manual was written to explain the hardwa re functions and electrical characteristics of this lsi to the above users. refer to the sh-3/sh-3e/sh3-dsp software manual for a detailed description of the instruction set. notes on reading this manual: ? product names the following products are covered in this manual. product classifications and abbreviations basic classification product code SH7641 hd6417641 ? in order to understand the overall functions of the chip read the manual according to the contents. this manual can be roughly categorized into parts on the cpu, system control functions, periph eral functions and elect rical characteristics. ? in order to understand the details of the cpu's functions read the sh-3/sh-3e/sh3-dsp software manual. this product does not support the mmu functions. for example, the ldtlb instruction code is executed as th e nop instruction.
rev. 4.00 sep. 14, 2005 page ix of l rules: register name: the following notatio n is used for cases when the same or a similar function, e.g. serial communication, is implemented on more than one channel: xxx_n (xxx is the register name and n is the channel number) bit order: the msb (most significant bit) is on the left and the lsb (least significant bit) is on the right. number notation: binary is b'xxxx, hexadecimal is h'xxxx, decimal is xxxx. signal notation: an overbar is added to a low-active signal: xxxx related manuals: the latest versions of all related manuals are available from our web site. please ensure you have the latest versions of all documents you require. http://www.renesas.com/eng/ SH7641manuals: document title document no. superh risc engine SH7641hardware manual this manual sh-3/sh-3e/sh3-dsp software manual rej09b0171 users manuals for development tools: document title document no. superh tm risc engine c/c++ compiler,assembler,optimizing linkage editor compiler package v.9.00 user's manual rej10b0152 superh tm risc engine high-performance embedded workshop 3 users manual rej10b0025 superh risc engine high-performance em bedded workshop 3 tutorial rej10b0023 application note: document title document no. superh risc engine c/c++ compiler package application note rej05b0463
rev. 4.00 sep. 14, 2005 page x of l abbreviations adc analog to digital converter alu arithmetic logic unit bpp bits per pixel bps bits per second bsc bus state controller codec coder-decoder cpg clock pulse generator cpu central processing unit crc cyclic redundancy check dmac direct memory access controller dsp digital signal processor esd electrostatic discharge ecc error checking and correction etu elementary time unit fifo first-in first-out hi-z high impedance h-udi user debugging interface intc interrupt controller lsb least significant bit msb most significant bit pc program counter pfc pin function controller pll phase locked loop ram random access memory risc reduced instruction set computer rom read only memory scif serial communicati on interface with fifo sof start of frame tap test access port t.b.d to be determined ubc user break controller
rev. 4.00 sep. 14, 2005 page xi of l usb universal serial bus wdt watch dog timer
rev. 4.00 sep. 14, 2005 page xii of l
rev. 4.00 sep. 14, 2005 page xiii of l contents section 1 overview................................................................................................1 1.1 features....................................................................................................................... ........... 1 1.2 block diagram .................................................................................................................. ..... 7 1.3 pin assign ments................................................................................................................ ..... 8 1.4 pin functions .................................................................................................................. ........ 9 section 2 cpu......................................................................................................25 2.1 registers...................................................................................................................... ......... 25 2.1.1 general registers.................................................................................................... 29 2.1.2 control registers .................................................................................................... 31 2.1.3 system regi sters..................................................................................................... 35 2.1.4 dsp registers ......................................................................................................... 35 2.2 data formats................................................................................................................... ..... 42 2.2.1 register data format (non-dsp type).................................................................. 42 2.2.2 dsp-type data formats ......................................................................................... 42 2.2.3 memory data formats ............................................................................................ 44 2.3 features of cpu co re instructions ...................................................................................... 44 2.4 instruction formats ............................................................................................................ .. 48 2.4.1 cpu instruction addr essing modes ....................................................................... 48 2.4.2 dsp data ad dressing ............................................................................................. 51 2.4.3 cpu instruction formats ........................................................................................ 58 2.4.4 dsp instruction formats......................................................................................... 61 2.5 instruction set ................................................................................................................ ...... 67 2.5.1 cpu instruction set ................................................................................................ 67 2.6 dsp extended-function instruc tions................................................................................... 81 2.6.1 introduc tion............................................................................................................. 81 2.6.2 added cpu system control instructions ............................................................... 82 2.6.3 single and double data transfer for dsp data instructions.................................. 84 2.6.4 dsp operation inst ruction set................................................................................ 88 section 3 dsp operation .....................................................................................99 3.1 data operations of dsp unit............................................................................................... 99 3.1.1 alu fixed-point operations.................................................................................. 99 3.1.2 alu integer operations ....................................................................................... 104 3.1.3 alu logical op erations....................................................................................... 105 3.1.4 fixed-point multipl y operation............................................................................ 107
rev. 4.00 sep. 14, 2005 page xiv of l 3.1.5 shift opera tions .................................................................................................... 109 3.1.6 most significant bit de tection oper ation ............................................................ 112 3.1.7 rounding operation.............................................................................................. 115 3.1.8 overflow protection.............................................................................................. 117 3.1.9 data transfer operation ....................................................................................... 118 3.1.10 local data move instruction ................................................................................ 122 3.1.11 operand conflict .................................................................................................. 123 3.2 dsp addr essi ng................................................................................................................. 124 3.2.1 dsp repeat control.............................................................................................. 124 3.2.2 dsp data addr essing ........................................................................................... 132 section 4 clock pulse generator (cpg) ........................................................... 143 4.1 features....................................................................................................................... ....... 143 4.2 input/output pins.............................................................................................................. .146 4.3 clock operatin g modes ..................................................................................................... 146 4.4 register desc riptions......................................................................................................... 1 49 4.4.1 frequency control re gister (f rqcr) ................................................................. 149 4.5 changing the frequency .................................................................................................... 151 4.5.1 changing the multip lication ra te......................................................................... 151 4.5.2 changing the divi sion rati o................................................................................. 151 4.6 notes on boar d design ...................................................................................................... 152 section 5 watchdog timer (wdt) ................................................................... 155 5.1 features....................................................................................................................... ....... 155 5.2 register desc riptions......................................................................................................... 1 56 5.2.1 watchdog timer coun ter (wtcnt).................................................................... 156 5.2.2 watchdog timer control/statu s register (w tcsr)............................................ 157 5.2.3 notes on regist er access ..................................................................................... 159 5.3 use of the wdt................................................................................................................. 159 5.3.1 canceling st andbys .............................................................................................. 159 5.3.2 changing the frequency ....................................................................................... 160 5.3.3 using watchdog ti mer mode .............................................................................. 160 5.3.4 using interval timer mode .................................................................................. 161 5.4 precautions to take wh en using th e wdt........................................................................ 161 section 6 power-down modes.......................................................................... 163 6.1 features....................................................................................................................... ....... 163 6.1.1 power-down modes ............................................................................................. 163 6.1.2 reset ..................................................................................................................... 164 6.1.3 input/output pins.................................................................................................. 165
rev. 4.00 sep. 14, 2005 page xv of l 6.2 register desc riptions ......................................................................................................... 1 66 6.2.1 standby control regi ster (st bcr)...................................................................... 166 6.2.2 standby control regist er 2 (st bcr2)................................................................. 167 6.2.3 standby control regist er 3 (st bcr3)................................................................. 168 6.2.4 standby control regist er 4 (st bcr4)................................................................. 170 6.3 operation ...................................................................................................................... ..... 171 6.3.1 sleep mode ........................................................................................................... 171 6.3.2 standby mode....................................................................................................... 172 6.3.3 module standby function..................................................................................... 174 6.3.4 status pin change timings.............................................................................. 174 section 7 cache .................................................................................................179 7.1 features....................................................................................................................... ....... 179 7.1.1 cache struct ure..................................................................................................... 180 7.2 register desc riptions ......................................................................................................... 1 82 7.2.1 cache control regist er 1 (ccr1) ........................................................................ 182 7.2.2 cache control regist er 2 (ccr2) ........................................................................ 183 7.3 cache oper ation................................................................................................................ .186 7.3.1 searching cache ................................................................................................... 186 7.3.2 read acces s.......................................................................................................... 188 7.3.3 prefetch operation ................................................................................................ 188 7.3.4 write acces s ......................................................................................................... 188 7.3.5 write-back buffer ................................................................................................ 189 7.3.6 coherency of cache and external memory .......................................................... 189 7.4 memory-mapped cache .................................................................................................... 190 7.4.1 address array ....................................................................................................... 190 7.4.2 data array ............................................................................................................ 190 7.4.3 usage examples.................................................................................................... 192 section 8 x/y memory......................................................................................193 8.1 features....................................................................................................................... ....... 193 8.2 x/y memory access from cpu ........................................................................................ 194 8.3 x/y memory access from dsp......................................................................................... 194 8.4 x/y memory access from dmac .................................................................................... 195 8.5 usage note..................................................................................................................... .... 195 8.6 sleep mode ..................................................................................................................... ... 195 8.7 address error .................................................................................................................. ... 195 section 9 exception handling ...........................................................................197 9.1 register desc riptions ......................................................................................................... 1 98
rev. 4.00 sep. 14, 2005 page xvi of l 9.1.1 trapa exception regi ster (tra) ...................................................................... 198 9.1.2 exception event regi ster (expevt)................................................................... 199 9.1.3 interrupt event regist er 2 (intevt2)................................................................. 199 9.2 exception handlin g function ............................................................................................ 200 9.2.1 exception hand ling flow ..................................................................................... 200 9.2.2 exception vector addresses................................................................................. 201 9.2.3 exception c odes ................................................................................................... 201 9.2.4 exception request and bl bit (mu ltiple exception pr evention) ......................... 201 9.2.5 exception source acceptance timing and pr iority .............................................. 202 9.3 individual exceptio n operatio ns ....................................................................................... 205 9.3.1 resets .................................................................................................................... 205 9.3.2 general exceptions............................................................................................... 206 9.4 exception processing while dsp ex tension function is valid......................................... 210 9.4.1 illegal instruction exception and slot illegal instruction exception .................... 210 9.4.2 exception in repeat control pe riod ..................................................................... 210 9.5 note on initializi ng this lsi .............................................................................................. 216 9.6 usage notes .................................................................................................................... ... 218 section 10 interrupt controller (intc)............................................................. 219 10.1 features....................................................................................................................... ....... 219 10.2 input/output pins.............................................................................................................. .221 10.3 register desc riptions......................................................................................................... 2 21 10.3.1 interrupt priority registers b to j (iprb to iprj)................................................ 223 10.3.2 interrupt control regi ster 0 (i cr0)...................................................................... 225 10.3.3 interrupt control regi ster 1 (i cr1)...................................................................... 226 10.3.4 interrupt control regi ster 3 (i cr3)...................................................................... 227 10.3.5 interrupt request regi ster 0 (irr0) ..................................................................... 228 10.3.6 interrupt mask registers 0 to 10 (imr0 to imr10) ............................................. 229 10.3.7 interrupt mask clear registers 0 to 10 (imcr0 to imcr 10) .............................. 231 10.4 interrupt sources.............................................................................................................. .. 233 10.4.1 nmi interrupt........................................................................................................ 233 10.4.2 h-udi interrupt .................................................................................................... 233 10.4.3 irq interr upts....................................................................................................... 233 10.4.4 on-chip peripheral mo dule interr upts ................................................................. 234 10.4.5 interrupt exception hand ling and prio rity............................................................ 235 10.5 intc oper ation ................................................................................................................. 238 10.5.1 interrupt sequence ................................................................................................ 238 10.5.2 multiple inte rrupts ................................................................................................ 240 10.6 notes on use................................................................................................................... ... 240 10.6.1 notes on usb bus po wer control........................................................................ 240
rev. 4.00 sep. 14, 2005 page xvii of l 10.6.2 timing to clear an interrupt so urce ..................................................................... 240 section 11 user break controller (ubc) ..........................................................241 11.1 features....................................................................................................................... ....... 241 11.2 register desc riptions ......................................................................................................... 2 43 11.2.1 break address regist er a (bara) ...................................................................... 243 11.2.2 break address mask regi ster a (bamra)......................................................... 244 11.2.3 break bus cycle regi ster a ( bbra)................................................................... 244 11.2.4 break address regist er b (ba rb) ...................................................................... 246 11.2.5 break address mask register b (b amrb) ......................................................... 247 11.2.6 break data regist er b (bdrb) ............................................................................ 247 11.2.7 break data mask regi ster b (b dmrb)............................................................... 248 11.2.8 break bus cycle regi ster b ( bbrb) ................................................................... 249 11.2.9 break control regi ster (brc r) ........................................................................... 251 11.2.10 execution times break register (betr)............................................................. 254 11.2.11 branch source regi ster (brs r)........................................................................... 254 11.2.12 branch destination re gister ( brdr)................................................................... 255 11.3 operation ...................................................................................................................... ..... 256 11.3.1 flow of the user br eak operation ........................................................................ 256 11.3.2 break on instructio n fetch cy cle.......................................................................... 257 11.3.3 break on data a ccess cycle................................................................................. 258 11.3.4 break on x/y-memory bus cycle........................................................................ 259 11.3.5 sequential break ................................................................................................... 260 11.3.6 value of saved prog ram counter ......................................................................... 260 11.3.7 pc trace ............................................................................................................... 261 11.3.8 usage examples.................................................................................................... 262 11.4 usage notes .................................................................................................................... ... 266 section 12 bus state controller (bsc)..............................................................269 12.1 features....................................................................................................................... ....... 269 12.2 input/output pins .............................................................................................................. .272 12.3 area overview .................................................................................................................. .273 12.3.1 area division........................................................................................................ 273 12.3.2 shadow area......................................................................................................... 274 12.3.3 address ma p ......................................................................................................... 275 12.3.4 area 0 memory type and memory bus width .................................................... 277 12.4 register desc riptions ......................................................................................................... 2 77 12.4.1 common control regi ster (cmncr) .................................................................. 278 12.4.2 csn space bus control register (csnbcr) (n = 0, 2, 3, 4, 5a, 5b, 6a, 6b) ..... 281 12.4.3 csn space wait control register (csnwcr) (n = 0, 2, 3, 4, 5a, 5b, 6a, 6b)... 286
rev. 4.00 sep. 14, 2005 page xviii of l 12.4.4 sdram control regi ster (sd cr)....................................................................... 314 12.4.5 refresh timer control/statu s register (r tcsr)................................................. 317 12.4.6 refresh timer coun ter (rtcnt)......................................................................... 319 12.4.7 refresh time constant register (rtcor) .......................................................... 319 12.4.8 reset wait counter (rwtcnt) .......................................................................... 320 12.5 operating desc ription........................................................................................................ 32 1 12.5.1 endian/access size and da ta alignment.............................................................. 321 12.5.2 normal space interface ........................................................................................ 324 12.5.3 access wait control ............................................................................................. 329 12.5.4 csn assert period expansion ............................................................................... 331 12.5.5 mpx-i/o inte rface................................................................................................ 332 12.5.6 sdram interface ................................................................................................. 335 12.5.7 burst rom (clock asynch ronous) interface ....................................................... 376 12.5.8 byte-selection sram interface ........................................................................... 377 12.5.9 burst mpx-i/o interface ...................................................................................... 382 12.5.10 burst rom interface (clo ck synchro nous).......................................................... 386 12.5.11 wait between acce ss cycles ................................................................................ 387 12.5.12 bus arbitrat ion ..................................................................................................... 399 12.5.13 others.................................................................................................................... 401 section 13 direct memory access controller (dmac)................................... 405 13.1 features....................................................................................................................... ....... 405 13.2 input/output pins.............................................................................................................. .407 13.3 register desc riptions......................................................................................................... 4 08 13.3.1 dma source address re gisters (sar)................................................................ 409 13.3.2 dma destination address registers (d ar)........................................................ 409 13.3.3 dma transfer count re gisters (dma tcr) ....................................................... 409 13.3.4 dma channel control re gisters (c hcr) ........................................................... 410 13.3.5 dma operation regist er (dmaor) ................................................................... 416 13.3.6 dma extension resource selector 0 and 1 (dmars0, dmars1).................... 421 13.4 operation ...................................................................................................................... ..... 424 13.4.1 dma transfer flow ............................................................................................. 424 13.4.2 dma transfer requests ....................................................................................... 426 13.4.3 channel prio rity.................................................................................................... 429 13.4.4 dma transfer types............................................................................................ 432 13.4.5 number of bus cycle states and dreq pin sampling timing ........................... 440 13.4.6 completion of dm a transfer .............................................................................. 444 13.4.7 notes on usage ..................................................................................................... 445 13.4.8 notes on dreq sampling when dack is divided in external access ............ 446
rev. 4.00 sep. 14, 2005 page xix of l section 14 u memory........................................................................................451 14.1 features....................................................................................................................... ....... 451 14.2 u memory access from cpu ............................................................................................ 452 14.3 u memory access from dsp............................................................................................. 452 14.4 u memory access from dmac ........................................................................................ 452 14.5 usage note..................................................................................................................... .... 453 14.6 sleep mode ..................................................................................................................... ... 453 14.7 address error .................................................................................................................. ... 453 section 15 user debuggi ng interface (h-udi) .................................................455 15.1 features....................................................................................................................... ....... 455 15.2 input/output pins .............................................................................................................. .456 15.3 register desc riptions ......................................................................................................... 4 57 15.3.1 bypass register (sdbpr) .................................................................................... 457 15.3.2 instruction regist er (sdir) .................................................................................. 457 15.3.3 boundary scan regist er (sdbsr) ....................................................................... 458 15.3.4 id register (sdid)............................................................................................... 467 15.4 operation ...................................................................................................................... ..... 468 15.4.1 tap contro ller ..................................................................................................... 468 15.4.2 reset configur ation .............................................................................................. 469 15.4.3 tdo output timing ............................................................................................. 469 15.4.4 h-udi reset ......................................................................................................... 470 15.4.5 h-udi interrupt .................................................................................................... 470 15.5 boundary scan .................................................................................................................. .471 15.5.1 supported inst ructions .......................................................................................... 471 15.5.2 points for a ttention............................................................................................... 472 15.6 usage notes .................................................................................................................... ... 472 section 16 i 2 c bus interface 2 (iic2) ................................................................473 16.1 features....................................................................................................................... ....... 473 16.2 input/output pins .............................................................................................................. .475 16.3 register desc riptions ......................................................................................................... 4 76 16.3.1 i 2 c bus control regist er 1 (iccr1 )..................................................................... 476 16.3.2 i 2 c bus control regist er 2 (iccr2 )..................................................................... 479 16.3.3 i 2 c bus mode regist er (icmr)............................................................................ 480 16.3.4 i 2 c bus interrupt enable register (i cier) ........................................................... 482 16.3.5 i 2 c bus status regi ster (icsr)............................................................................. 484 16.3.6 slave address regi ster (sar).............................................................................. 486 16.3.7 i 2 c bus transmit data re gister (icdrt)............................................................. 487 16.3.8 i 2 c bus receive data re gister (icd rr).............................................................. 487
rev. 4.00 sep. 14, 2005 page xx of l 16.3.9 i 2 c bus shift regist er (icdrs)............................................................................ 487 16.3.10 nf2cyc register (nf2cyc).............................................................................. 487 16.4 operation ...................................................................................................................... ..... 488 16.4.1 i 2 c bus format...................................................................................................... 488 16.4.2 master transmit operation................................................................................... 489 16.4.3 master receive operation .................................................................................... 491 16.4.4 slave transmit op eration ..................................................................................... 493 16.4.5 slave receive op eration....................................................................................... 496 16.4.6 clocked synchronous serial format .................................................................... 497 16.4.7 noise filte r ........................................................................................................... 501 16.4.8 example of use..................................................................................................... 502 16.5 interrupt request.............................................................................................................. .. 506 16.6 bit synchronous circuit..................................................................................................... 507 16.7 usage note..................................................................................................................... .... 508 section 17 compare match timer (cmt) ........................................................ 509 17.1 features....................................................................................................................... ....... 509 17.2 register desc riptions......................................................................................................... 5 10 17.2.1 compare match timer start register (c mstr) .................................................. 510 17.2.2 compare match timer control/sta tus register (cmcsr) .................................. 511 17.2.3 compare match counte r (cmcnt ) .................................................................... 512 17.2.4 compare match constant register (c mcor) ..................................................... 512 17.3 operation ...................................................................................................................... ..... 513 17.3.1 interval count operation ...................................................................................... 513 17.3.2 cmcnt count timing......................................................................................... 513 17.4 compare ma tches .............................................................................................................. 51 4 17.4.1 timing of compare ma tch flag se tting ............................................................... 514 17.4.2 dma transfer requests an d interrupt re quests .................................................. 514 17.4.3 timing of compare matc h flag clearing............................................................. 515 section 18 multi-function timer pulse unit (mtu)........................................ 517 18.1 features....................................................................................................................... ....... 517 18.2 input/output pins.............................................................................................................. .521 18.3 register desc riptions......................................................................................................... 5 22 18.3.1 timer control regi ster (tcr).............................................................................. 524 18.3.2 timer mode regist er (tmdr)............................................................................. 528 18.3.3 timer i/o control re gister (tior)...................................................................... 530 18.3.4 timer interrupt enable register (tier)............................................................... 548 18.3.5 timer status regi ster (tsr)................................................................................. 550 18.3.6 timer counter (tcnt)......................................................................................... 553
rev. 4.00 sep. 14, 2005 page xxi of l 18.3.7 timer general regi ster (tgr) ............................................................................. 553 18.3.8 timer start regist er (tstr) ................................................................................ 554 18.3.9 timer synchro regi ster (tsyr) .......................................................................... 554 18.3.10 timer output master enab le register (toer) .................................................... 556 18.3.11 timer output control register (t ocr)............................................................... 557 18.3.12 timer gate control re gister (tgcr) .................................................................. 559 18.3.13 timer subcounter (tcnts) ................................................................................. 561 18.3.14 timer dead time data register (tddr)............................................................. 561 18.3.15 timer period data re gister (t cdr) .................................................................... 561 18.3.16 timer period buffer register (tcbr).................................................................. 561 18.3.17 bus master in terface............................................................................................. 562 18.4 operation ...................................................................................................................... ..... 562 18.4.1 basic func tions..................................................................................................... 562 18.4.2 synchronous op eration......................................................................................... 568 18.4.3 buffer operation ................................................................................................... 571 18.4.4 cascaded oper ation .............................................................................................. 574 18.4.5 pwm modes ......................................................................................................... 576 18.4.6 phase counting mode........................................................................................... 581 18.4.7 reset-synchronized pwm mode.......................................................................... 588 18.4.8 complementary pwm mode................................................................................ 591 18.5 interrupts..................................................................................................................... ....... 616 18.5.1 interrupts and priority ........................................................................................... 616 18.5.2 dma activat ion ................................................................................................... 618 18.5.3 a/d converter ac tivation ..................................................................................... 618 18.6 operation timing............................................................................................................... 619 18.6.1 input/output timing ............................................................................................. 619 18.6.2 interrupt signal timing......................................................................................... 624 18.7 usage notes .................................................................................................................... ... 627 18.7.1 module standby m ode setti ng ............................................................................. 627 18.7.2 input clock rest rictions ....................................................................................... 627 18.7.3 caution on peri od setting ..................................................................................... 628 18.7.4 conflict between tcnt write and clear operations .......................................... 628 18.7.5 conflict between tcnt write an d increment operations ................................... 629 18.7.6 conflict between tgr write and compare match............................................... 630 18.7.7 conflict between buffer register write and comp are match .............................. 630 18.7.8 conflict between tgr read and input capture ................................................... 632 18.7.9 conflict between tgr write and input capture .................................................. 633 18.7.10 conflict between buffer register write and inpu t capture.................................. 634 18.7.11 tcnt2 write and overflow/underflow co nflict in cascade connection ........... 634 18.7.12 counter value during comple mentary pwm mode stop .................................... 636
rev. 4.00 sep. 14, 2005 page xxii of l 18.7.13 buffer operation se tting in complement ary pwm mode ................................... 636 18.7.14 reset sync pwm mode buffer opera tion and compare match flag .................. 637 18.7.15 overflow flags in rese t sync pwm mode.......................................................... 638 18.7.16 conflict between overflow/underfl ow and counter clearing ............................. 638 18.7.17 conflict between tcnt write and overflow/underflow .................................... 639 18.7.18 cautions on transition from normal operation or pwm mode 1 to reset-synchronou s pwm mode........................................................................... 640 18.7.19 output level in complementary pwm mode and reset-synchronous pwm mode .......................................................................................................... 640 18.7.20 interrupts in module standby mode ..................................................................... 640 18.7.21 simultaneous input capture of tcnt_1 and tcnt_2 in cascade conn ection.............................................................................................. 640 18.8 mtu output pin in itializatio n........................................................................................... 641 18.8.1 operating m odes .................................................................................................. 641 18.8.2 reset start op eration ............................................................................................ 641 18.8.3 operation in case of re-setting due to error during oper ation, etc. ................. 642 18.8.4 overview of initialization procedures and mode transitions in case of error during oper ation, et c. ................................................................................. 643 18.9 port output enab le (poe) ................................................................................................. 673 18.9.1 features................................................................................................................. 673 18.9.2 pin configuration.................................................................................................. 675 18.9.3 register config uration.......................................................................................... 675 18.9.4 operation .............................................................................................................. 681 section 19 serial communication interface with fifo (scif)........................ 685 19.1 overview....................................................................................................................... ..... 685 19.1.1 features................................................................................................................. 685 19.2 pin config uration.............................................................................................................. .688 19.3 register desc ription .......................................................................................................... 6 89 19.3.1 receive shift regi ster (scrs r) .......................................................................... 690 19.3.2 receive fifo data re gister (scf rdr) .............................................................. 690 19.3.3 transmit shift regi ster (sct sr) ......................................................................... 690 19.3.4 transmit fifo data re gister (scftdr)............................................................. 691 19.3.5 serial mode regist er (scsmr)............................................................................ 691 19.3.6 serial control register (scs cr).......................................................................... 695 19.3.7 serial status regi ster (scfsr) ............................................................................ 699 19.3.8 bit rate regist er (scbrr) .................................................................................. 707 19.3.9 fifo control regi ster (scf cr) .......................................................................... 714 19.3.10 fifo data count regi ster (scfdr).................................................................... 717 19.3.11 serial port regist er (scsptr) ............................................................................. 717
rev. 4.00 sep. 14, 2005 page xxiii of l 19.3.12 line status regist er (sclsr) .............................................................................. 720 19.4 operation ...................................................................................................................... ..... 721 19.4.1 overview............................................................................................................... 721 19.4.2 operation in asynch ronous mode ........................................................................ 723 19.4.3 synchronous op eration......................................................................................... 733 19.5 scif interrupts and dmac............................................................................................... 742 19.6 usage notes .................................................................................................................... ... 743 section 20 usb function module .....................................................................747 20.1 features....................................................................................................................... ....... 747 20.1.1 block diag ram...................................................................................................... 748 20.2 pin config uration.............................................................................................................. .748 20.3 register desc riptions ......................................................................................................... 7 49 20.3.1 usb interrupt flag regi ster 0 (usb ifr0)........................................................... 750 20.3.2 usb interrupt flag regi ster 1 (usb ifr1)........................................................... 751 20.3.3 usb interrupt flag regi ster 2 (usb ifr2)........................................................... 752 20.3.4 usb interrupt select regi ster 0 (usbisr0) ........................................................ 753 20.3.5 usb interrupt select regi ster 1 (usbisr1) ........................................................ 754 20.3.6 usb interrupt enable regi ster 0 (usbier0)....................................................... 754 20.3.7 usb interrupt enable regi ster 1 (usbier1)....................................................... 755 20.3.8 usb interrupt enable regi ster 2 (usbier2)....................................................... 755 20.3.9 usbep0i data register (usbepdr0i) ............................................................... 756 20.3.10 usbep0o data register (usbepdr0o).............................................................. 756 20.3.11 usbep0s data register (usbepdr0s)............................................................... 757 20.3.12 usbep1 data regist er (usbepdr1).................................................................. 757 20.3.13 usbep2 data regist er (usbepdr2).................................................................. 758 20.3.14 usbep3 data regist er (usbepdr3).................................................................. 758 20.3.15 usbep0o receive data size re gister (usbepsz0o) ......................................... 758 20.3.16 usbep1 receive data size register (usbepsz1) ............................................. 759 20.3.17 usb trigger regist er (usbtrg) ........................................................................ 759 20.3.18 usb data status regi ster (usbdasts) ............................................................. 760 20.3.19 usbfifo clear regist er (usbfclr)................................................................. 761 20.3.20 usbdma transfer setting re gister (usb dmar) ............................................. 762 20.3.21 usb endpoint stall regi ster (usbepstl) ......................................................... 763 20.3.22 usb transceiver control register (u sbxvercr) ............................................ 764 20.3.23 usb bus power control re gister (us bctrl) ................................................... 765 20.4 operation ...................................................................................................................... ..... 766 20.4.1 cable connect ion.................................................................................................. 766 20.4.2 cable disconn ection ............................................................................................. 767 20.4.3 control tran sfer.................................................................................................... 768
rev. 4.00 sep. 14, 2005 page xxiv of l 20.4.4 ep1 bulk-out transfer (dual fifos) ................................................................ 774 20.4.5 ep2 bulk-in transfer (dual fifos) .................................................................... 776 20.4.6 ep3 interrupt-in transfer..................................................................................... 778 20.5 processing of usb standard command s and class/vendor commands .......................... 779 20.5.1 processing of commands transm itted by control transfer................................. 779 20.6 stall oper ations............................................................................................................... ... 780 20.6.1 forcible stall by applicatio n ................................................................................ 780 20.6.2 automatic stall by us b function module ........................................................... 782 20.7 dma tran sfer................................................................................................................... .784 20.7.1 dma transfer for endpoint 1 .............................................................................. 784 20.7.2 dma transfer for endpoint 2 .............................................................................. 785 20.8 example of usb extern al circu itry .................................................................................. 786 20.9 usb bus power cont rol meth od....................................................................................... 789 20.9.1 usb bus power contro l operation ...................................................................... 789 20.9.2 usage example of usb bus power control method ........................................... 790 20.10 notes on usage ................................................................................................................. .794 20.10.1 receiving setu p data ........................................................................................... 794 20.10.2 clearing fifo....................................................................................................... 794 20.10.3 overreading or overwri ting data re gister........................................................... 794 20.10.4 assigning interrupt source for ep0...................................................................... 795 20.10.5 clearing fifo when sett ing dma transfer ........................................................ 795 20.10.6 manual reset for dm a transfer.......................................................................... 795 20.10.7 usb clock............................................................................................................ 795 20.10.8 using tr interrupt................................................................................................ 795 section 21 a/d converter ................................................................................. 797 21.1 features....................................................................................................................... ....... 797 21.1.1 block diag ram...................................................................................................... 798 21.1.2 input pi ns.............................................................................................................. 799 21.1.3 register config uration.......................................................................................... 800 21.2 register desc riptions......................................................................................................... 8 00 21.2.1 a/d data registers a to d (addra0 to addrd0, addra1 to addrd1) ... 800 21.2.2 a/d control/status register s (adcsr0, adcsr1)............................................ 801 21.2.3 a/d0, a/d1 control re gister (adcr) ................................................................ 804 21.3 operation ...................................................................................................................... ..... 805 21.3.1 single mode.......................................................................................................... 805 21.3.2 multi mode ........................................................................................................... 806 21.3.3 scan mode ............................................................................................................ 808 21.3.4 simultaneous samplin g operation ....................................................................... 809 21.3.5 a/d converter activat ion by mtu...................................................................... 810
rev. 4.00 sep. 14, 2005 page xxv of l 21.3.6 input sampling and a/d conversion time .......................................................... 810 21.4 interrupt and dmac tr ansfer request.............................................................................. 812 21.5 definitions of a/d co nversion accuracy.......................................................................... 813 21.6 usage notes .................................................................................................................... ... 815 21.6.1 setting analog in put voltage ............................................................................... 815 21.6.2 processing of analog input pins........................................................................... 815 21.6.3 permissible signal s ource impedance .................................................................. 815 21.6.4 influences on abso lute precision.......................................................................... 816 21.6.5 stop during a/d conversi on ................................................................................ 816 section 22 pin functio n controller (pfc).........................................................819 22.1 register desc riptions ......................................................................................................... 8 23 22.1.1 port a control regi ster (pacr) .......................................................................... 824 22.1.2 port b control re gister (p bcr)........................................................................... 826 22.1.3 port c control re gister (p ccr)........................................................................... 827 22.1.4 port d control regi ster (pdcr) .......................................................................... 828 22.1.5 port e control regi ster (pecr) ........................................................................... 830 22.1.6 port e i/o regist er (peior)................................................................................. 832 22.1.7 port e mtu r/w enable re gister (pemtu rwer) ........................................... 833 22.1.8 port f control regi ster (pfcr)............................................................................ 834 22.1.9 port g control regi ster (pgcr) .......................................................................... 836 22.1.10 port h control regi ster (phcr) .......................................................................... 838 22.1.11 port j control regi ster (pjcr) ............................................................................. 839 22.2 i/o buffer internal block diagram .................................................................................... 841 22.2.1 i/o buffer with weak keeper............................................................................... 841 22.2.2 i/o buffer with open drain output...................................................................... 841 22.3 notes on usage ................................................................................................................. .842 section 23 i/o ports ...........................................................................................843 23.1 port a......................................................................................................................... ........ 843 23.1.1 register desc ription ............................................................................................. 843 23.1.2 port a data regi ster (padr)............................................................................... 844 23.2 port b ......................................................................................................................... ........ 845 23.2.1 register desc ription ............................................................................................. 845 23.2.2 port b data regi ster (pbdr) ............................................................................... 846 23.3 port c ......................................................................................................................... ........ 847 23.3.1 register desc ription ............................................................................................. 847 23.3.2 port c data regi ster (pcdr) ............................................................................... 848 23.4 port d......................................................................................................................... ........ 849 23.4.1 register desc ription ............................................................................................. 850
rev. 4.00 sep. 14, 2005 page xxvi of l 23.4.2 port d data regi ster (pddr)............................................................................... 850 23.5 port e ......................................................................................................................... ........ 851 23.5.1 register desc ription ............................................................................................. 852 23.5.2 port e data regi ster (pedr)................................................................................ 852 23.6 port f ......................................................................................................................... ........ 853 23.6.1 register desc ription ............................................................................................. 854 23.6.2 port f data regi ster (pfdr) ................................................................................ 854 23.7 port g......................................................................................................................... ........ 856 23.7.1 register desc ription ............................................................................................. 856 23.7.2 port g data regi ster (pgdr)............................................................................... 857 23.7.3 port g internal bl ock diagram ............................................................................. 859 23.8 port h......................................................................................................................... ........ 860 23.8.1 register desc ription ............................................................................................. 860 23.8.2 port h data regi ster (phdr)............................................................................... 861 23.9 port j ......................................................................................................................... ......... 862 23.9.1 register desc ription ............................................................................................. 862 23.9.2 port j data regi ster (pjdr) ................................................................................. 863 section 24 list of registers............................................................................... 865 24.1 register addresses (by functional module, in order of th e corresponding sec tion numbers) ........................... 866 24.2 register bits.................................................................................................................. ..... 876 24.3 register states in ea ch operating mode ........................................................................... 896 section 25 electrical characteristics ................................................................. 907 25.1 absolute maximum ratings .............................................................................................. 907 25.1.1 power-on sequence.............................................................................................. 908 25.2 dc charact eristics ............................................................................................................. 910 25.3 ac charact eristics ............................................................................................................. 915 25.3.1 clock timing ........................................................................................................ 916 25.3.2 control signal timing .......................................................................................... 920 25.3.3 ac bus ti ming..................................................................................................... 923 25.3.4 basic timi ng......................................................................................................... 925 25.3.5 bus cycle of byte-s election sr am..................................................................... 932 25.3.6 burst rom read cycle ........................................................................................ 934 25.3.7 synchronous dram timing ................................................................................ 935 25.3.8 peripheral module si gnal timing......................................................................... 954 25.3.9 multi function timer puls e unit ti ming ............................................................. 956 25.3.10 poe module signa l timing ................................................................................. 957 25.3.11 i 2 c module signa l timing .................................................................................... 958
rev. 4.00 sep. 14, 2005 page xxvii of l 25.3.12 h-udi related pi n timing................................................................................... 960 25.3.13 usb module signa l timing ................................................................................. 962 25.3.14 usb transceive r timing ...................................................................................... 963 25.3.15 ac characteristics meas urement cond itions ....................................................... 964 25.4 a/d converter char acteristic s ........................................................................................... 965 appendix .........................................................................................................967 a. pin states..................................................................................................................... ....... 967 a.1 when other function is select ed.......................................................................... 967 a.2 when i/o port is selected..................................................................................... 971 b. product lineup................................................................................................................. .. 972 c. package dime nsions .......................................................................................................... 973 main revisions and additions in this edition .....................................................975 index .........................................................................................................977
rev. 4.00 sep. 14, 2005 page xxviii of l
rev. 4.00 sep. 14, 2005 page xxix of l figures section 1 overview figure 1.1 block di agram .............................................................................................................. 7 figure 1.2 pin a ssignments (bga-256)......................................................................................... 8 section 2 cpu figure 2.1 register configurati on in each processi ng mode (1) ................................................. 27 figure 2.2 register configurati on in each processi ng mode (2) ................................................. 28 figure 2.3 general regist ers (not in dsp mode) ........................................................................ 29 figure 2.4 general registers (dsp mode) ................................................................................... 30 figure 2.5 cont rol regist ers (1) ............................................................................................. ...... 33 figure 2.5 cont rol regist ers (2) ............................................................................................. ...... 34 figure 2.6 sy stem registers .................................................................................................. ....... 35 figure 2.7 dsp registers..................................................................................................... ......... 39 figure 2.8 connections of dsp registers and buses ................................................................... 39 figure 2.9 longword operand.................................................................................................. .... 42 figure 2.10 data formats ..................................................................................................... ........ 43 figure 2.11 byte, word, and longword alignment ..................................................................... 44 figure 2.12 x and y data transfer addressing ........................................................................... 53 figure 2.13 single data transfer addressing............................................................................... 54 figure 2.14 modulo addressing ................................................................................................ ... 55 figure 2.15 dsp instruction formats .......................................................................................... .61 figure 2.16 sample para llel instructio n program......................................................................... 89 figure 2.17 examples of conditional oper ations and data tran sfer instructions ....................... 97 section 3 dsp operation figure 3.1 alu fixed-poin t arithmetic oper ation flow............................................................. 99 figure 3.2 operatio n sequence ex ample.................................................................................... 101 figure 3.3 dc bit generation exam ples in carry or borrow mode .......................................... 101 figure 3.4 dc bit generation ex amples in negative value mode ............................................ 102 figure 3.5 dc bit generation examples in overflow mode...................................................... 102 figure 3.6 alu integer ar ithmetic operat ion flow .................................................................. 104 figure 3.7 alu logi cal operatio n flow ................................................................................... 106 figure 3.8 fixed-point multiply opera tion flow ....................................................................... 107 figure 3.9 arithmetic shift operatio n flow............................................................................... 109 figure 3.10 logical shift operatio n flow .................................................................................. 111 figure 3.11 pdms b operation flow ......................................................................................... 113 figure 3.12 roundin g operation flow ....................................................................................... 116 figure 3.13 definition of rounding op eration........................................................................... 116
rev. 4.00 sep. 14, 2005 page xxx of l figure 3.14 data tran sfer operatio n flow................................................................................. 119 figure 3.15 single data-trans fer operation flow (word)......................................................... 120 figure 3.16 single data-transfe r operation flow (longword) ................................................. 121 figure 3.17 local data move instruc tion flow.......................................................................... 122 figure 3.18 restriction of inte rrupt acceptance in repeat loop ............................................... 128 figure 3.19 dsp addressing instru ctions for movx.w and movy.w................................... 134 figure 3.20 dsp addressi ng instructions for movs ................................................................ 135 figure 3.21 modulo addressing ................................................................................................ .136 figure 3.22 load/store control for x and y data-transfer instructions................................... 140 figure 3.23 load/store control for single-data transfer instruction........................................ 141 section 4 clock pulse generator (cpg) figure 4.1 block diagram of clock pulse generator ................................................................. 144 figure 4.2 note on usin g a crystal re sonator ........................................................................... 152 figure 4.3 note on using a pll oscillator circuit .................................................................... 153 section 5 watchdog timer (wdt) figure 5.1 block di agram of the wdt ...................................................................................... 156 figure 5.2 writing to wtcnt and wtcsr.............................................................................. 159 section 6 power-down modes figure 6.1 canceling stan dby mode with stbcr.stby .......................................................... 173 figure 6.2 status out put at manual reset............................................................................. 175 figure 6.3 status output when standby mode is canceled by an interrupt.......................... 175 figure 6.4 status output when software st andby mode is canceled by a manual reset.... 176 figure 6.5 status output when sleep mode is canceled by an interrupt .............................. 176 figure 6.6 status output when sleep mode is canceled by a manual reset ....................... 177 section 7 cache figure 7.1 cache structure ................................................................................................... ...... 180 figure 7.2 cache search scheme ............................................................................................... 187 figure 7.3 write-back buffer configur ation .............................................................................. 189 figure 7.4 specifying ad dress and data for memory -mapped cache access .......................... 191 section 8 x/y memory figure 8.1 x/y memory address mapping................................................................................ 194 section 9 exception handling figure 9.1 register bit config uration ........................................................................................ 198 section 10 interrupt controller (intc) figure 10.1 bloc k diagram of intc.......................................................................................... 22 0 figure 10.2 interrupt operation flowchart................................................................................. 239
rev. 4.00 sep. 14, 2005 page xxxi of l section 11 user break controller (ubc) figure 11.1 block diagram of user break controller................................................................ 242 section 12 bus state controller (bsc) figure 12.1 bsc func tional block di agram.............................................................................. 271 figure 12.2 address space .................................................................................................... ..... 274 figure 12.3 normal space basic access timing (a ccess wait 0)............................................. 324 figure 12.4 continuous access for normal space 1 bus width = 16 bits, longword access, csnwcr.wn bit = 0 (access wa it = 0, cycle wait = 0) .................................... 325 figure 12.5 continuous access for normal space 2 bus width = 16 bits, longword access, csnwcr.wn bit = 1 (access wa it = 0, cycle wait = 0) .................................... 326 figure 12.6 example of 32-bit data-width sram connectio n ................................................ 327 figure 12.7 example of 16-bit data-width sram connectio n ................................................ 328 figure 12.8 example of 8-bit data-width sram connection .................................................. 328 figure 12.9 wait timing for normal space access (softwar e wait only ) ............................... 329 figure 12.10 wait state ti ming for normal space access (wait state insertion using wait signal) ........................................................... 330 figure 12.11 csn assert period expansion................................................................................ 331 figure 12.12 access timing for mpx space (a ddress cycle no wait, data cycle no wait) . 332 figure 12.13 access timing for mpx space (a ddress cycle wait 1, data cycle no wait) .... 333 figure 12.14 access timing for mpx space (address cycle access wait 1, data cycle wait 1, external wa it 1)..................................................................... 334 figure 12.15 example of 32-bit data width sdram connection ( rasu and casu are not used)......................................................................... 336 figure 12.16 example of 16-bit data width sdram connection ( rasu and casu are not used)......................................................................... 337 figure 12.17 example of 16-bit data width sdram connection ( rasu and casu are used)................................................................................ 338 figure 12.18 burst read basic timing (cas latency 1, auto pre-charge) ............................. 352 figure 12.19 burst read wait specification timing (cas latency 2, wtrcd1 and wtrcd0 = 1 cycle, au to pre-charge) ............................................................... 353 figure 12.20 basic timing for single read (cas latency 1, auto pre-charge) ...................... 354 figure 12.21 basic timing for bu rst write (auto pre-charge) ................................................. 356 figure 12.22 single write basi c timing (auto-precharge) ........................................................ 357 figure 12.23 burst read timing (bank ac tive, different bank, cas latency 1) .................... 359 figure 12.24 burst read timing (bank active, same row addresses in the same bank, cas latenc y 1)..................................................................................................... 360 figure 12.25 burst read timing (bank active, different row addresses in the same bank, cas latenc y 1)..................................................................................................... 361 figure 12.26 single write timing (bank active, different bank) ............................................ 362 figure 12.27 single write timing (bank active, same row addresses in the same bank)..... 363
rev. 4.00 sep. 14, 2005 page xxxii of l figure 12.28 single write timing (bank active, differe nt row addresses in the same bank) ................................ 364 figure 12.29 auto-refresh timing ............................................................................................ 3 66 figure 12.30 se lf-refresh timing ............................................................................................. .367 figure 12.31 low-freque ncy mode access timing .................................................................. 369 figure 12.32 power-down mode access timing ...................................................................... 370 figure 12.33 synchronous dram mode write timing (based on jedec)............................. 373 figure 12.34 emrs co mmand issue timing............................................................................. 374 figure 12.35 deep power-do wn mode transition timing ........................................................ 375 figure 12.36 burst rom access timing (clock asynchronous) (bus width = 32 bits, 16-byte transfer (number of burst 4), wait cycles inserted in first access = 2, wait cycles inserted in second and subsequent ac cesses = 1)..................................................................................... 377 figure 12.37 byte-selection ram basic access timing (bas = 0)......................................... 378 figure 12.38 byte-selection ram basic access timing (bas = 1)......................................... 379 figure 12.39 byte-selection sram wait timing (bas = 1) (sw[1:0] = 01, wr[3:0] = 0001, hw [1:0] = 01) .......................................................................... 380 figure 12.40 example of connection with 32-bit data-width byte -selection sram ............. 381 figure 12.41 example of connection with 16-bit data-width byte -selection sram ............. 381 figure 12.42 burst mpx de vice connection example.............................................................. 382 figure 12.43 burst mpx space access timing (sin gle read, no wait, or software wait 1) .. 383 figure 12.44 burst mpx space access timing (single write, software wa it 1, hardware wait 1) .............................................. 384 figure 12.45 burst mpx space access timing (b urst read, no wait, or software wait 1, cs6bwcr.mpxmd = 0) .................................................................................... 385 figure 12.46 burst mpx space acces s timing (burst write, no wait, cs6bwcr.mpxmd = 0) .................................................................................... 386 figure 12.47 burst rom access timing (clock synchronous) (burst length = 8, wait cycles inserted in first access = 2, wait cycles inserted in second and subsequent a ccesses = 1) ........................... 387 figure 12.48 bus arbitration timing (c lock mode 7 or cmncr.hizcnt = 1) ..................... 400 section 13 direct memo ry access controller (dmac) figure 13.1 block di agram of the dmac ................................................................................. 406 figure 13.2 dma transfer flowchart........................................................................................ 425 figure 13.3 round-robin mode................................................................................................. 430 figure 13.4 changes in channel priority in roun d-robin mode............................................... 431 figure 13.5 data flow of dual addr ess mode........................................................................... 433 figure 13.6 example of dma transfer timing in dual mode (source: ordinary memory, destin ation: ordinary memory) ................................ 434 figure 13.7 data flow in single addr ess mode......................................................................... 435
rev. 4.00 sep. 14, 2005 page xxxiii of l figure 13.8 example of dma transf er timing in single address mode.................................. 436 figure 13.9 dma transfer exampl e in the cycle-steal normal mode (dual address, dreq low level de tection)......................................................... 437 figure 13.10 example of dma transfer in cycle steal intermittent mode (dual address, dreq low level de tection)....................................................... 438 figure 13.11 dma transfer example in the burst mode (dual address, dreq low level de tection)....................................................... 438 figure 13.12 bus state when mu ltiple channels ar e operating................................................ 440 figure 13.13 example of dreq input detection in cycle steal mode edge detection............ 441 figure 13.14 example of dreq input detection in cycle steal mode level detection........... 441 figure 13.15 example of dreq input detection in burst mode edge detection ..................... 441 figure 13.16 example of dreq input detection in burst m ode level detection .................... 442 figure 13.17 example of dreq input detection in burst mode level detection .................... 442 figure 13.18 bsc ordinary memory a ccess (no wait, idle cy cle 1, longword access to 16-b it device) ...................................................................................... 443 figure 13.19 example of dreq input detection in cycle steal mode edge detection when dack is divided to 4 by idle cycles ........................................................ 447 figure 13.20 example of dreq input detection in cycle steal mode edge detection when dack is divided to 2 by idle cycles ........................................................ 447 figure 13.21 example of dreq input det ection in cycle steal mo de level detection when dack is divided to 4 by idle cycles ........................................................ 448 figure 13.22 example of dreq input det ection in cycle steal mo de level detection when dack is divided to 2 by idle cycles ........................................................ 449 section 14 u memory figure 14.1 u memory address ma pping.................................................................................. 452 section 15 user debugging interface (h-udi) figure 15.1 block diagram of h-udi........................................................................................ 455 figure 15.2 tap contro ller state tran sitions ............................................................................ 468 figure 15.3 h-udi da ta transfer timing.................................................................................. 470 figure 15.4 h-udi reset...................................................................................................... ...... 470 section 16 i2c bus interface 2 (iic2) figure 16.1 block diagram of i 2 c bus interf ace 2..................................................................... 474 figure 16.2 external circu it connections of i/o pins ................................................................ 475 figure 16.3 i 2 c bus form ats ...................................................................................................... 488 figure 16.4 i 2 c bus timi ng........................................................................................................ 488 figure 16.5 master transmit mode operation timing (1) ......................................................... 490 figure 16.6 master transmit mode operation timing (2) ......................................................... 490 figure 16.7 master receive mode operation timing (1)........................................................... 492 figure 16.8 master receive mode operation timing (2)........................................................... 493
rev. 4.00 sep. 14, 2005 page xxxiv of l figure 16.9 slave transmit mode operation timing (1) ........................................................... 494 figure 16.10 slave transmit mode operation timing (2) ......................................................... 495 figure 16.11 slave receive mode operation timing (1)........................................................... 496 figure 16.12 slave receive mode operation timing (2)........................................................... 497 figure 16.13 clocked synchron ous serial transfer format....................................................... 497 figure 16.14 transmit mode operatio n timing......................................................................... 498 figure 16.15 receive mo de operation timing .......................................................................... 500 figure 16.16 operation ti ming for receiving one byte .......................................................... 500 figure 16.17 block diag ram of noise filter .............................................................................. 501 figure 16.18 sample flowchar t for master tr ansmit mode ...................................................... 502 figure 16.19 sample flowchar t for master r eceive mode ........................................................ 503 figure 16.20 sample flowchar t for slave tran smit mode......................................................... 504 figure 16.21 sample flowch art for slave r eceive mode .......................................................... 505 figure 16.22 the timing of th e bit synchronou s circuit .......................................................... 507 section 17 compare match timer (cmt) figure 17.1 block diagram of compare match timer............................................................... 509 figure 17.2 co unter operation ................................................................................................ ... 513 figure 17.3 count timing ..................................................................................................... ..... 513 figure 17.4 timi ng of cmf setting ........................................................................................... 5 14 section 18 multi-functi on timer pulse unit (mtu) figure 18.1 block diagram of mtu .......................................................................................... 520 figure 18.2 complementary pwm mode output level example ............................................. 558 figure 18.3 example of counte r operation setting procedure .................................................. 563 figure 18.4 free-runnin g counter operation ............................................................................ 564 figure 18.5 periodic counter operation..................................................................................... 56 4 figure 18.6 example of setting procedure for waveform output by compare match.............. 565 figure 18.7 example of 0 ou tput/1 output operation ............................................................... 565 figure 18.8 example of t oggle output op eration ..................................................................... 566 figure 18.9 example of input ca pture operation settin g procedure ......................................... 567 figure 18.10 example of input capture op eration .................................................................... 568 figure 18.11 example of synchro nous operation settin g procedure ........................................ 569 figure 18.12 example of synchronous op eration...................................................................... 570 figure 18.13 compare ma tch buffer operation......................................................................... 571 figure 18.14 input capt ure buffer op eration............................................................................. 572 figure 18.15 example of buffe r operation setting procedure................................................... 572 figure 18.16 example of buffer operation (1) .......................................................................... 573 figure 18.17 example of buffer operation (2) .......................................................................... 574 figure 18.18 cascaded op eration setting procedure ................................................................. 575 figure 18.19 example of cascaded operation ........................................................................... 575
rev. 4.00 sep. 14, 2005 page xxxv of l figure 18.20 example of pw m mode setting pr ocedure .......................................................... 578 figure 18.21 example of pwm mode opera tion (1) ................................................................. 578 figure 18.22 example of pwm mode opera tion (2) ................................................................. 579 figure 18.23 example of pwm mode opera tion (3) ................................................................. 580 figure 18.24 example of phase counting mode settin g procedure........................................... 582 figure 18.25 example of phase counting mode 1 operation .................................................... 582 figure 18.26 example of phase counting mode 2 operation .................................................... 583 figure 18.27 example of phase counting mode 3 operation .................................................... 584 figure 18.28 example of phase counting mode 4 operation .................................................... 585 figure 18.29 phase counting mode applicati on example......................................................... 587 figure 18.30 procedure for selecti ng the reset-synchronized pwm mode.............................. 589 figure 18.31 reset-synchronized pwm mode operation example (when the tocr's olsn = 1 and olsp = 1) ..................................................... 590 figure 18.32 block diagram of channels 3 and 4 in complementary pwm mode .................. 593 figure 18.33 example of compleme ntary pwm mode setti ng procedure................................ 594 figure 18.34 complementary pw m mode counter operation.................................................. 596 figure 18.35 example of comple mentary pwm mode operation ............................................ 597 figure 18.36 example of pwm cycle up dating........................................................................ 600 figure 18.37 example of data up date in complement ary pwm mode .................................... 601 figure 18.38 example of initial output in compleme ntary pwm mode (1)............................. 602 figure 18.39 example of initial output in compleme ntary pwm mode (2)............................. 603 figure 18.40 example of complementar y pwm mode waveform output (1) ......................... 605 figure 18.41 example of complementar y pwm mode waveform output (2) ......................... 606 figure 18.42 example of complementar y pwm mode waveform output (3) ......................... 607 figure 18.43 example of complementary pwm mode 0% and 100% waveform output (1).................................................................................. 608 figure 18.44 example of complementary pwm mode 0% and 100% waveform output (2)............................................................................................ 609 figure 18.45 example of complementary pwm mode 0% and 100% waveform output (3)............................................................................................ 609 figure 18.46 example of complementary pwm mode 0% and 100% waveform output (4)............................................................................................ 610 figure 18.47 example of complementary pwm mode 0% and 100% waveform output (5)............................................................................................ 610 figure 18.48 example of toggle output wa veform synchronized with pwm output............. 611 figure 18.49 counter clearing sync hronized with anot her channel ........................................ 612 figure 18.50 example of output phas e switching by extern al input (1)................................... 613 figure 18.51 example of output phas e switching by extern al input (2)................................... 614 figure 18.52 example of output phase switching by means of uf, vf, wf bit setti ngs (1) ............................................................................................... 614
rev. 4.00 sep. 14, 2005 page xxxvi of l figure 18.53 example of output phase switching by means of uf, vf, wf bit setti ngs (2) ............................................................................................... 615 figure 18.54 count timing in internal clock operation............................................................ 619 figure 18.55 count timing in external clock operation .......................................................... 619 figure 18.56 count timing in external clock operation (phase counting mode).................... 620 figure 18.57 output compare output timing (normal mode/pwm mode)............................. 620 figure 18.58 output compare output timing (complementary pwm mode/ reset synchronou s pwm mode).......................................................................... 621 figure 18.59 input capt ure input signa l timing........................................................................ 621 figure 18.60 counter clea r timing (compare match) .............................................................. 622 figure 18.61 counter clea r timing (input capture) .................................................................. 622 figure 18.62 buffer operat ion timing (compa re match) ......................................................... 623 figure 18.63 buffer operat ion timing (input capture) ............................................................. 623 figure 18.64 tgi interrup t timing (compare match) ............................................................... 624 figure 18.65 tgi interrup t timing (input capture) ................................................................... 624 figure 18.66 tciv interrupt setting timing.............................................................................. 625 figure 18.67 tciu interrupt setting timing.............................................................................. 625 figure 18.68 timing for status flag clearing by the cpu ........................................................ 626 figure 18.69 timing for status fl ag clearing by dm a activation ........................................... 626 figure 18.70 phase difference, overlap, and pulse width in phase counting mode ................ 627 figure 18.71 conflict between tc nt write and clear operations ........................................... 628 figure 18.72 conflict between tcnt write and increment operations.................................... 629 figure 18.73 conflict between tgr write and comp are match ............................................... 630 figure 18.74 conflict between buffer regi ster write and compare match (channel 0)........... 631 figure 18.75 conflict between buffer register write and compare match (channels 3 and 4) ................................................................................................ 631 figure 18.76 conflict between tgr read and input capture.................................................... 632 figure 18.77 conflict between tgr write and input capture................................................... 633 figure 18.78 conflict between buffer register write and input capt ure .................................. 634 figure 18.79 tcnt_2 write and overflow/und erflow conflict with cascade connection...... 635 figure 18.80 counter value during complementary pwm mode stop .................................... 636 figure 18.81 buffer operation and compar e-match flags in reset sync pwm mode............. 637 figure 18.82 reset sync pwm mode overfl ow flag ................................................................ 638 figure 18.83 conflict between overflow and counte r clearing ................................................ 639 figure 18.84 conflict betwee n tcnt write and overflow ....................................................... 639 figure 18.85 error occurrence in norm al mode, recovery in normal mode........................... 644 figure 18.86 error occurrence in norm al mode, recovery in pwm mode 1........................... 645 figure 18.87 error occurrence in norm al mode, recovery in pwm mode 2........................... 646 figure 18.88 error occurrence in normal mode, recovery in ph ase counting mode .............. 647 figure 18.89 error occurrence in normal mode, recovery in complementary pwm mode ... 648
rev. 4.00 sep. 14, 2005 page xxxvii of l figure 18.90 error occurrence in normal mode, recovery in reset-synchronous pwm mode........................................................................................................... 649 figure 18.91 error occurrence in pwm mode 1, recovery in normal mode........................... 650 figure 18.92 error occurrence in pwm mode 1, recovery in pwm mode 1 .......................... 651 figure 18.93 error occurrence in pwm mode 1, recovery in pwm mode 2 .......................... 652 figure 18.94 error occurrence in pwm mode 1, recovery in phase counting mode.............. 653 figure 18.95 error occurrence in pwm mode 1, recovery in complementary pwm mode ................................................................................ 654 figure 18.96 error occurrence in pwm mode 1, recovery in reset-synchronous pwm mode........................................................................................................... 655 figure 18.97 error occurrence in pwm mode 2, recovery in normal mode........................... 656 figure 18.98 error occurrence in pwm mode 2, recovery in pwm mode 1 .......................... 657 figure 18.99 error occurrence in pwm mode 2, recovery in pwm mode 2 .......................... 658 figure 18.100 error occurrence in pwm m ode 2, recovery in phase counting mode............ 659 figure 18.101 error occurrence in phase counting mode, recovery in normal mode ............ 660 figure 18.102 error occurrence in phase counting mode, recovery in pwm mode 1............ 661 figure 18.103 error occurrence in phase counting mode, recovery in pwm mode 2............ 662 figure 18.104 error occurrence in phase counting mode, recovery in phase counting mode .......................................................................................... 663 figure 18.105 error occurrence in complementary pwm mode, recovery in normal mode....................................................................................................... 664 figure 18.106 error occurrence in complementary pwm mode, recovery in pw m mode 1 .................................................................................. 665 figure 18.107 error occurrence in complementary pwm mode, recovery in complementary pwm mode........................................................... 666 figure 18.108 error occurrence in complementary pwm mode, recovery in complementary pwm mode ............................................................................... 667 figure 18.109 error occurrence in complementary pwm mode, recovery in reset-synchronous pwm mode.......................................................................... 668 figure 18.110 error occurrence in reset-synchronous pwm mode, recovery in normal mode....................................................................................................... 669 figure 18.111 error occurrence in reset-synchronous pwm mode, recovery in pwm mode 1....................................................................................................... 670 figure 18.112 error occurrence in reset-synchronous pwm mode, recovery in complementary pwm mode ............................................................................... 671 figure 18.113 error occurrence in reset-synchronous pwm mode, recovery in reset-synchronous pwm mode.......................................................................... 672 figure 18.114 poe block diagram............................................................................................ 67 4 figure 18.115 falling edge detection op eration ....................................................................... 681 figure 18.116 low-leve l detection op eration.......................................................................... 682
rev. 4.00 sep. 14, 2005 page xxxviii of l figure 18.117 output-level detection op eration ...................................................................... 682 section 19 serial communicati on interface with fifo (scif) figure 19.1 bloc k diagram of scif........................................................................................... 6 87 figure 19.2 example of data format in asynchronous communication (8-bit data with parity and two stop bits) ........................................................... 723 figure 19.3 sample flowch art for scif in itializatio n ............................................................... 726 figure 19.4 sample flowchart for transmitting serial data...................................................... 727 figure 19.5 example of transmit opera tion (8-bit data, parity , one stop bit)........................ 729 figure 19.6 example of operation using modem control ( cts ).............................................. 729 figure 19.7 sample flowchar t for receiving se rial data .......................................................... 730 figure 19.8 sample flowchart for receiving serial data (cont)................................................ 731 figure 19.9 example of scif receive oper ation (8-bit data, parity , one stop bit)................ 733 figure 19.10 example of operation using modem control ( rts )............................................ 733 figure 19.11 data format in synchronous co mmunication ...................................................... 734 figure 19.12 sample flowch art for scif in itializatio n ............................................................. 735 figure 19.13 sample flowchart for transmitting se rial data.................................................... 736 figure 19.14 example of sc if transmit operation................................................................... 737 figure 19.15 sample flowchart for receiving serial data (1)................................................... 738 figure 19.16 sample flowchart for receiving serial data (2)................................................... 739 figure 19.17 example of scif receive op eration .................................................................... 740 figure 19.18 sample flowchart for transmitting/receiving serial da ta................................... 741 figure 19.19 receive data sampli ng timing in asynchronous mode ...................................... 745 figure 19.20 dma transfer exampl e in the synchroni zation clock ........................................ 746 section 20 usb function module figure 20.1 bloc k diagram of usb ........................................................................................... 74 8 figure 20.2 cable c onnection oper ation ................................................................................... 766 figure 20.3 cable disc onnection oper ation............................................................................... 767 figure 20.4 transfer stag es in control transfer ........................................................................ 768 figure 20.5 set up stage operation ............................................................................................ .769 figure 20.6 data stage (control-in) op eration ......................................................................... 770 figure 20.7 data stage (control-out) op eration ..................................................................... 771 figure 20.8 status stage (control-in) operation ....................................................................... 772 figure 20.9 status stage (control-out) op eration ................................................................... 773 figure 20.10 ep1 bulk-out transfer operation....................................................................... 775 figure 20.11 ep2 bulk-i n transfer operation........................................................................... 777 figure 20.12 ep3 interrupt- in transfer op eration .................................................................... 778 figure 20.13 forcible stall by app lication ................................................................................ 781 figure 20.14 automatic sta ll by usb functi on module............................................................ 783 figure 20.15 ep1 rdfn operation............................................................................................ 78 4
rev. 4.00 sep. 14, 2005 page xxxix of l figure 20.16 ep 2 pkte operation ............................................................................................ 78 5 figure 20.17 example of usb function module external circuitry (for on-chip transceiver).................................................................................... 787 figure 20.18 example of usb function module external circuitry (for external transceiver) .................................................................................... 788 figure 20.19 irq0 and irq1 interrupt circuitry ....................................................................... 790 figure 20.20 usb stan dby operation timing ........................................................................... 790 figure 20.21 sample flowchart for initializa tion of the usb bus power control method ....... 791 figure 20.22 sample flowchart for changing the state from usb suspend to standby ........... 792 figure 20.23 sample flowchart for awake ............................................................................ 793 figure 20.24 timing for set ting the tr interrupt flag .............................................................. 796 section 21 a/d converter figure 21.1 block diag ram of a/d c onverter ........................................................................... 798 figure 21.2 example of a/d converter operation (single mode, channel 1 selected) ............ 806 figure 21.3 example of a/d converter operation (multi mode, channels an 0 to an2 sel ected) ..................................................... 807 figure 21.4 example of a/d converter operation (scan mode, channels an0 to an2 selected) ........................................................................................................ 809 figure 21.5 a/d conversion timing .......................................................................................... 81 1 figure 21.6 definitions of a/d conversion accuracy ............................................................... 814 figure 21.7 example of anal og input protection circuit ........................................................... 817 figure 21.8 analog input pin equivalent circuit ....................................................................... 817 figure 21.9 example of analog input circuit ............................................................................ 817 section 22 pin function controller (pfc) figure 22.1 internal block diagram of i/o buffer with weak keeper ...................................... 841 figure 22.2 internal block diagram of i/o buffer with open drain ......................................... 842 section 23 i/o ports figure 23.1 port a ........................................................................................................... ........... 843 figure 23.2 port b ........................................................................................................... ........... 845 figure 23.3 port c ........................................................................................................... ........... 847 figure 23.4 port d ........................................................................................................... ........... 849 figure 23.5 port e........................................................................................................... ............ 851 figure 23.6 port f ........................................................................................................... ............ 853 figure 23.7 port g ........................................................................................................... ........... 856 figure 23.8 internal block diagram of pg7dt to pg0dt ........................................................ 859 figure 23.9 port h ........................................................................................................... ........... 860 figure 23.10 port j.......................................................................................................... ............ 862
rev. 4.00 sep. 14, 2005 page xl of l section 25 electrical characteristics figure 25.1 power-on sequence ................................................................................................ 908 figure 25.2 extal clock input timing ................................................................................... 917 figure 25.3 ckio clock input timing ...................................................................................... 917 figure 25.4 ckio and ck io2 clock input timing ................................................................... 917 figure 25.5 oscillation se ttling timing (p ower-on) ................................................................. 918 figure 25.6 phase difference between ckio and ckio2 ......................................................... 918 figure 25.7 oscillation settling timing (standby mode cancel ed by reset)............................ 918 figure 25.8 oscillation settling timing (standby mode canceled by nmi or irq )................. 919 figure 25.9 re set input timing............................................................................................... ... 921 figure 25.10 inte rrupt input timing.......................................................................................... .921 figure 25.11 bu s release timing .............................................................................................. 922 figure 25.12 pin driving timing in stan dby mode ................................................................... 922 figure 25.13 basic bus timing for normal space (no wait).................................................... 925 figure 25.14 basic bus timing for normal space (software 1 wait) ....................................... 926 figure 25.15 basic bus timing for normal space (one cycle of externally input/ waitsel = 0) ..................................................................................................... 927 figure 25.16 basic bus timing for normal space (one cycle of externally input/ waitsel = 1) ..................................................................................................... 928 figure 25.17 basic bus timing for normal space (one cycle of software wait, external wait cycle valid (wm bit = 0), no id le cycl e).................................... 929 figure 25.18 mpx-io interface bus cycle (three address cycles, one software wait cycle, on e external wa it cycle) .......................................... 930 figure 25.19 burst mpx-io inte rface bus cycle single read write (one address cycle, one software wait) ............................................................ 931 figure 25.20 byte-selection sram bus cy cle (sw = 1 cycle, hw = 1 cycle, one asynchronous external wait cycle, bas = 0 (write cycle ub/lb control)) .... 932 figure 25.21 byte-selection sram bus cy cle (sw = 1 cycle, hw = 1 cycle, one asynchronous external wait cycle, ba s = 1 (write cycle we control)).......... 933 figure 25.22 burst rom read cycle (one software wait cycle, one asynchronous external burst wait cy cle, two bu rst) ................................................................ 934 figure 25.23 synchronous dram single read bus cycle (auto precharge, cas latency 2, wtrcd = 0 cycle, wtrp = 0 cycle) ...................................... 935 figure 25.24 synchronous dram single read bus cycle (auto precharge, cas latency 2, wtrcd = 1 cycle, wtrp = 1 cycle) ...................................... 936 figure 25.25 synchronous dram burst read bus cycle (four read cycles) (auto precharge, cas latency 2, wt rcd = 0 cycle, wtrp = 1 cycle) .......... 937 figure 25.26 synchronous dram burst read bus cycle (four read cycles) (auto precharge, cas latency 2, wt rcd = 1 cycle, wtrp = 0 cycle) .......... 938
rev. 4.00 sep. 14, 2005 page xli of l figure 25.27 synchronous dram single write bus cycle (auto precharge, tr wl = 1 cy cle) ..................................................................... 939 figure 25.28 synchronous dram single write bus cycle (auto precharge, wtrcd = 2 cycles, tr wl = 1 cycle) ............................................................... 940 figure 25.29 synchronous dram burst write bus cycle (four write cycles) (auto precharge, wtrcd = 0 cycle, trwl = 1 cycle) .................................... 941 figure 25.30 synchronous dram burst write bus cycle (four write cycles) (auto precharge, wtrcd = 1 cycle, trwl = 1 cycle) .................................... 942 figure 25.31 synchronous dram burst read bus cycle (four read cycles) (bank active mode: act + read commands, cas latency 2, wtrcd = 0 cycle) ............ 943 figure 25.32 synchronous dram burst read bus cycle (four read cycles) (bank active mode: read command, same row address, cas latency 2, wtrcd = 0 cycle) ................................................................................................ 944 figure 25.33 synchronous dram burst read bus cycle (four read cycles) (bank active mode: pre + act + read commands, different row addresses, cas latenc y 2, wtrcd = 0 cycle) ........................................ 945 figure 25.34 synchronous dram burst write bus cycle (four write cycles) (bank active mode: act + write commands, wtrcd = 0 cycle, trwl = 0 cycle) ................................................................................................. 946 figure 25.35 synchronous dram burst write bus cycle (four write cycles) (bank active mode: write command, same row address, wtrcd = 0 cycle, tr wl = 0 cycle)................................................................. 947 figure 25.36 synchronous dram burst write bus cycle (four write cycles) (bank active mode: pre + act + write commands, different row addresses, wtrcd = 0 cycle, trwl = 0 cycle) ..................... 948 figure 25.37 synchronous dram auto-refreshing timing (wtrp = 1 cycle, wtrc = 3 cy cles)................................................................................................ 949 figure 25.38 synchronous dram self-r efreshing timing (w trp = 1 cycle) ...................... 950 figure 25.39 synchronous dram mode re gister write timing (wtrp = 1 cycle)............... 951 figure 25.40 synchronous dram a ccess timing in low-frequency mode (auto-precharge, trwl = 2 cycl es) ................................................................... 952 figure 25.41 synchronous dram self-refreshing timing in low-frequency mode (wtrp = 2 cycles)............................................................................................... 953 figure 25.42 sck i nput clock ti ming....................................................................................... 954 figure 25.43 scif input/output timing in synchronous mode ................................................ 955 figure 25.44 i/o port timing ................................................................................................. .... 955 figure 25.45 dreq input timing.............................................................................................. 955 figure 25.46 dack , tend output timing .............................................................................. 955 figure 25.47 mtu i nput/output ti ming.................................................................................... 956
rev. 4.00 sep. 14, 2005 page xlii of l figure 25.48 mtu cl ock input timing ..................................................................................... 956 figure 25.49 poe in put/output timing ..................................................................................... 957 figure 25.50 i 2 c bus interface input/o utput timing ................................................................. 959 figure 25.51 tck input timing................................................................................................ .960 figure 25.52 trst input timing (reset -hold state) ................................................................ 961 figure 25.53 h-udi da ta transfer timing................................................................................ 961 figure 25.54 boundary-sc an input/output timing.................................................................... 961 figure 25.55 usb clock timing................................................................................................ 962 figure 25.56 output load circuit ............................................................................................. .964 appendix figure c.1 package dimensions................................................................................................ .973
rev. 4.00 sep. 14, 2005 page xliii of l tables section 1 overview table 1.1 features..................................................................................................................... 1 table 1.2 pin functions ............................................................................................................. 9 table 1.3 pin functions .......................................................................................................... 18 section 2 cpu table 2.1 initial register values............................................................................................. 28 table 2.2 destination register in dsp instructions................................................................ 37 table 2.3 source register in dsp operations ........................................................................ 38 table 2.4 dsr register bits................................................................................................... 41 table 2.5 word data sign extension...................................................................................... 45 table 2.6 delayed branch instructions................................................................................... 45 table 2.7 t bit ........................................................................................................................ 46 table 2.8 immediate data referencing .................................................................................. 46 table 2.9 absolute address referencing................................................................................ 47 table 2.10 displacement re ferencing ...................................................................................... 47 table 2.11 addressing modes and effective ad dresses for cpu instructions......................... 48 table 2.12 overview of data transfer instructions.................................................................. 51 table 2.13 cpu instruction formats ........................................................................................ 58 table 2.14 double data transfer instruction formats ............................................................. 62 table 2.15 single data transfer in struction formats ............................................................... 63 table 2.16 a-field parallel data tr ansfer instructions ............................................................ 64 table 2.17 b-field alu operation instructions and multiply instructions (1) ....................... 65 table 2.17 b-field alu operation instructions and multiply instructions (2) ....................... 66 table 2.18 cpu instruction types............................................................................................ 67 table 2.19 data transfer instructions....................................................................................... 71 table 2.20 arithmetic operatio n instructions .......................................................................... 73 table 2.21 logic operation instructions .................................................................................. 75 table 2.22 shift instru ctions..................................................................................................... 76 table 2.23 branch instructions ................................................................................................. 77 table 2.24 system control instructions.................................................................................... 78 table 2.25 added cpu system cont rol instructions ............................................................... 82 table 2.26 double data transf er instructions.......................................................................... 85 table 2.27 single data transfer instructions ........................................................................... 86 table 2.28 correspondence between dsp data tran sfer operands and registers .................. 87 table 2.29 dsp operation instru ction formats ........................................................................ 88 table 2.30 correspondence between dsp instruc tion operands and registers ....................... 89
rev. 4.00 sep. 14, 2005 page xliv of l table 2.31 dsp operation instructions .................................................................................... 90 table 2.32 dc bit update definitions ..................................................................................... 96 table 2.33 examples of nopx and nopy instruction codes................................................. 98 section 3 dsp operation table 3.1 variation of alu fixed- point opera tions............................................................ 100 table 3.2 correspondence between oper ands and registers ............................................... 100 table 3.3 variation of alu inte ger operations ................................................................... 104 table 3.4 variation of alu logi cal operations .................................................................. 106 table 3.5 variation of fixed-point multiply oper ation ....................................................... 108 table 3.6 correspondence between oper ands and registers ............................................... 108 table 3.7 variation of shif t operations................................................................................ 109 table 3.8 operation definition of pdmsb .......................................................................... 114 table 3.9 variation of pdms b operation............................................................................ 115 table 3.10 variation of roundin g operation ......................................................................... 116 table 3.11 definition of overflow protection for fixed-point arithmetic operations .......... 117 table 3.12 definition of overflow protection fo r integer arithmetic operations.................. 117 table 3.13 variation of local data move oper ations............................................................ 122 table 3.14 correspondence between oper ands and registers ............................................... 123 table 3.15 address value to be stored into spc (1).............................................................. 125 table 3.16 address value to be stored into spc (2).............................................................. 126 table 3.17 rs and re set ting rule........................................................................................ 128 table 3.18 summary of dsp data tran sfer instructions ....................................................... 133 section 4 clock pulse generator (cpg) table 4.1 pin configuration and functions of the clock pulse generator ........................... 146 table 4.2 clock operatin g modes ........................................................................................ 146 table 4.3 relationship between clock mode and frequency range.................................... 147 section 6 power-down modes table 6.1 states of power- down modes .............................................................................. 164 table 6.2 pin configuration.................................................................................................. 165 table 6.3 register states in standby mode .......................................................................... 172 section 7 cache table 7.1 cache specifi cations............................................................................................. 179 table 7.2 address space subdivisions and cache oper ation............................................... 179 table 7.3 lru and way re placement ................................................................................. 181 table 7.4 way to be replaced when a cache miss occurs in pref instruction ................. 185 table 7.5 way to be replaced when a cache miss occu rs in other than pref instruction .. 185 table 7.6 lru and way replacement (when w2lo ck = 1 and w3lock = 0)............... 185 table 7.7 lru and way replacement (when w2lo ck = 0 and w3lock = 1)............... 186
rev. 4.00 sep. 14, 2005 page xlv of l table 7.8 lru and way replacement (when w2lo ck = 1 and w3lock = 1)............... 186 section 8 x/y memory table 8.1 x/y memory speci fications ................................................................................. 193 section 9 exception handling table 9.1 exception event vectors....................................................................................... 204 table 9.2 type of reset........................................................................................................ 206 table 9.3 instruction positions and restriction types.......................................................... 210 table 9.4 spc value when a re-execution type exce ption occurs in repeat control ..... 213 table 9.5 exception acceptance in the repeat loop ........................................................... 214 table 9.6 instruction where a specific exception occurs when a memory access exception occurs in repeat control............................. 215 section 10 interrupt controller (intc) table 10.1 pin configuration.................................................................................................. 221 table 10.2 interrupt sources an d iprb to iprj ..................................................................... 224 table 10.3 correspondence between interrupt s ources and imr0 to imr10 ........................ 230 table 10.4 correspondence between interrupt sources and imcr0 to imcr10................... 232 table 10.5 interrupt exception handling sources and pr iority .............................................. 236 section 11 user break controller (ubc) table 11.1 specifying break addr ess regist er ...................................................................... 246 table 11.2 specifying break da ta regist er............................................................................ 248 table 11.3 data access cycle addresses and oper and size comparison conditions ........... 258 section 12 bus state controller (bsc) table 12.1 pin configuration.................................................................................................. 272 table 12.2 address space map 1 (cmncr.map = 0).......................................................... 275 table 12.3 address space map 2 (cmncr.map = 1).......................................................... 276 table 12.4 correspondence between external pin md3 and bus width of area 0 ............... 277 table 12.5 32-bit external device access and data alignment ............................................ 321 table 12.6 16-bit external device access and data alignment ............................................ 322 table 12.7 8-bit external device access and data alignment .............................................. 323 table 12.8 relationship between bsz1, 0, a2/3row1, 0, and address multiplex ou tput (1)- 1............................................................................ 340 table 12.8 relationship between bsz1, 0, a2/3row1, 0, and address multiplex ou tput (1)- 2............................................................................ 341 table 12.9 relationship between bsz1, 0, a2/3row1, 0, and address multiplex ou tput (2)- 1............................................................................ 342 table 12.9 relationship between bsz1, 0, a2/3row1, 0, and address multiplex ou tput (2)- 2............................................................................ 343
rev. 4.00 sep. 14, 2005 page xlvi of l table 12.10 relationship between bsz1, 0, a2/3row1, 0, and address multiplex output (3 )........................................................................... 344 table 12.11 relationship between bsz1, 0, a2/3row1, 0, and address multiplex ou tput (4)- 1........................................................................ 345 table 12.11 relationship between bsz1, 0, a2/3row1, 0, and address multiplex ou tput (4)- 2........................................................................ 346 table 12.12 relationship between bsz1, 0, a2/3row1, 0, and address multiplex ou tput (5)- 1........................................................................ 347 table 12.12 relationship between bsz1, 0, a2/3row1, 0, and address multiplex ou tput (5)- 2........................................................................ 348 table 12.13 relationship between bsz1, 0, a2/3row1, 0, and address multiplex ou tput (6)- 1........................................................................ 349 table 12.13 relationship between bsz1, 0, a2/3row1, 0, and address multiplex ou tput (6)- 2........................................................................ 350 table 12.14 relationship between access size and number of bursts................................ 351 table 12.15 access address in sdram m ode register write ........................................... 371 table 12.16 output addresses when emrs command is issued........................................ 374 table 12.17 relationship between bus width, acce ss size, and number of bursts............ 376 table 12.18 minimum number of idle cycles between cpu access cycles for the normal space in terface ........................................ 389 table 12.19 minimum number of idle cycles between access cycles during dmac dual address mode transfer for the normal space interface............. 390 table 12.20 minimum number of idle cycles du ring dmac single address mode transfer to the normal space interface from the external device with dack ............................................................................ 391 table 12.21 minimum number of idle cycles be tween access cycles of cpu and the dmac dual address mode for the sdram interface.............................. 393 table 12.22 minimum number of idle cycles between access cycles of the dmac single address mode for the sdram interface ........................... 396 section 13 direct memory access controller (dmac) table 13.1 pin configuration.................................................................................................. 407 table 13.2 combination of the round-robin select bits and priority mode bits ................. 420 table 13.3 transfer request modu le/register id .................................................................. 423 table 13.4 selecting external request m odes with the rs bits ............................................ 426 table 13.5 selecting external request det ection with dl, ds bits ....................................... 427 table 13.6 selecting external request de tection with do bit .............................................. 427 table 13.7 selecting on-chip peripheral module request modes with the rs3 to rs0 bits .............................................................................................. 428 table 13.8 supported dma transfers.................................................................................... 432 table 13.9 relationship of request modes and bus modes by dma transfer category ..... 439
rev. 4.00 sep. 14, 2005 page xlvii of l section 14 u memory table 14.1 u memory speci fications ..................................................................................... 451 section 15 user debugging interface (h-udi) table 15.1 pin configuration.................................................................................................. 456 table 15.2 h-udi commands................................................................................................ 458 table 15.3 this lsi pins and boundary scan regist er bits................................................... 459 table 15.4 reset configur ation .............................................................................................. 469 section 16 i2c bus interface 2 (iic2) table 16.1 i 2 c bus interface pin co nfiguratio n ..................................................................... 475 table 16.2 transfer rate ........................................................................................................ 478 table 16.3 interrupt re quests ................................................................................................. 506 table 16.4 time for monitoring scl..................................................................................... 507 section 18 multi-functi on timer pulse unit (mtu) table 18.1 mtu functio ns..................................................................................................... 518 table 18.2 mtu pin config uration........................................................................................ 521 table 18.3 cclr0 to cclr2 (channels 0, 3, and 4) ............................................................ 525 table 18.4 cclr0 to cclr2 (channels 1 and 2) ................................................................. 525 table 18.5 tpsc0 to tpsc2 (channel 0) .............................................................................. 526 table 18.6 tpsc0 to tpsc2 (channel 1) .............................................................................. 526 table 18.7 tpsc0 to tpsc2 (channel 2) .............................................................................. 527 table 18.8 tpsc0 to tpsc2 (cha nnels 3 an d 4) ................................................................... 527 table 18.9 md0 to md3 ........................................................................................................ 529 table 18.10 tiorh_0 (channel 0) ...................................................................................... 532 table 18.11 tiorl_0 (channel 0)....................................................................................... 533 table 18.12 tior_1 (channel 1) ......................................................................................... 534 table 18.13 tior_2 (channel 2) ......................................................................................... 535 table 18.14 tiorh_3 (channel 3) ...................................................................................... 536 table 18.15 tiorl_3 (channel 3)....................................................................................... 537 table 18.16 tiorh_4 (channel 4) ...................................................................................... 538 table 18.17 tiorl_4 (channel 4)....................................................................................... 539 table 18.18 tiorh_0 (channel 0) ...................................................................................... 540 table 18.19 tiorl_0 (channel 0)....................................................................................... 541 table 18.20 tior_1 (channel 1) ......................................................................................... 542 table 18.21 tior_2 (channel 2) ......................................................................................... 543 table 18.22 tiorh_3 (channel 3) ...................................................................................... 544 table 18.23 tiorl_3 (channel 3)....................................................................................... 545 table 18.24 tiorh_4 (channel 4) ...................................................................................... 546 table 18.25 tiorl_4 (channel 4)....................................................................................... 547 table 18.26 output level sel ect function ........................................................................... 557
rev. 4.00 sep. 14, 2005 page xlviii of l table 18.27 output level sel ect function ........................................................................... 558 table 18.28 output level sel ect function............................................................................. 560 table 18.29 register combinations in buffer operation ..................................................... 571 table 18.30 cascaded comb inations.................................................................................... 574 table 18.31 pwm output registers and output pins .......................................................... 577 table 18.32 phase counting mode cl ock input pins ........................................................... 581 table 18.33 up/down-count conditions in phase counting mode 1.................................. 583 table 18.34 up/down-count conditions in phase counting mode 2.................................. 584 table 18.35 up/down-count conditions in phase counting mode 3.................................. 585 table 18.36 up/down-count conditions in phase counting mode 4.................................. 586 table 18.37 output pins for reset-sy nchronized pwm mode ............................................ 588 table 18.38 register settings for reset- synchronized pwm mode.................................... 588 table 18.39 output pins for complementary pwm mode .................................................. 591 table 18.40 register settings for comp lementary pw m mode .......................................... 592 table 18.41 registers and counters re quiring initiali zation ............................................... 598 table 18.42 mtu interrupts................................................................................................. 617 table 18.43 mode transition co mbinations ........................................................................ 642 table 18.44 pin configuration.............................................................................................. 675 table 18.45 pin combinations.............................................................................................. 675 section 19 serial communicati on interface with fifo (scif) table 19.1 scif pins.............................................................................................................. 688 table 19.2 scsmr settin gs ................................................................................................... 707 table 19.3 bit rates and scbrr settings in asynchronous mode....................................... 708 table 19.4 bit rates and scbrr settings in synchronous mode ......................................... 711 table 19.5 maximum bit rates for various frequencies with baud rate generator (a synchronous mode) ........................................................ 712 table 19.6 maximum bit rates with external cl ock input (asynchronous mode)............... 713 table 19.7 maximum bit rates with external cl ock input (synchr onous mode) ................. 713 table 19.8 scsmr settings and scif co mmunication fo rmats .......................................... 722 table 19.9 scsmr and scscr settings and scif clock source selection......................... 722 table 19.10 serial communication formats (asynchronous mode).................................... 724 table 19.11 scif interrup t sources ..................................................................................... 743 section 20 usb function module table 20.1 pin configuration and functions .......................................................................... 748 table 20.2 command decoding on a pplication side ............................................................ 779 section 21 a/d converter table 21.1 a/d converter pins............................................................................................... 799 table 21.2 analog input channels and a/d data regi sters................................................... 801 table 21.3 a/d conversion time (single mode)................................................................... 811
rev. 4.00 sep. 14, 2005 page xlix of l table 21.4 a/d conversion time (multi mode and scan mode) .......................................... 811 table 21.5 interrupt and dmac tr ansfer request ................................................................ 812 section 22 pin function controller (pfc) table 22.1 list of multiple xed pins........................................................................................ 819 section 23 i/o ports table 23.1 port a data register (padr) read/write operations ......................................... 845 table 23.2 port b data register (pbdr) read/write operations.......................................... 846 table 23.3 port c data register (pcdr) read/write operations.......................................... 849 table 23.4 port d data register (pddr) read/write operations ......................................... 851 table 23.5 port e data register (pedr) read/write operations .......................................... 853 table 23.6 port f data register (pfdr) read/write operations (pf15dt to pf8dt) ........ 855 table 23.7 port f data register (pfdr) read/write operations (pf7dt to pf0dt) .......... 855 table 23.8 port g data register (pgdr ) read/write operations (pg13dt to pg11d t, pg8dt)............................................................................ 858 table 23.9 port g data register (pgdr) read/write operations (pg10dt to pg9dt)...... 858 table 23.10 port g data register (pgdr) read/write operations (pg7dt to pg0dt).... 858 table 23.11 port h data register (phdr) read/write operations ..................................... 862 table 23.12 port j data register (pjdr) read/write operations........................................ 863 section 25 electrical characteristics table 25.1 absolute maximum ratings ................................................................................. 907 table 25.2 recommended values for power-on/off sequence............................................. 909 table 25.3 dc characteristics (1) [common items] .............................................................. 910 table 25.3 dc characteristics (2) [except for i 2 c- and usb-rela ted pins] .......................... 911 table 25.3 dc characteristics (3) [i 2 c-related pins] ............................................................ 913 table 25.3 dc characteristics (4) [u sb-related pins].......................................................... 913 table 25.3 dc characteristics (5) [usb tr ansceiver-relate d pins] ...................................... 914 table 25.4 permissible output currents ................................................................................. 914 table 25.5 maximum operating frequency ........................................................................... 915 table 25.6 clock timing ........................................................................................................ 916 table 25.7 control signal timing .......................................................................................... 920 table 25.8 bus timing ........................................................................................................... 923 table 25.9 peripheral module si gnal timing......................................................................... 954 table 25.10 multi function timer pu lse unit ti ming ......................................................... 956 table 25.11 output enable (poe) timing ........................................................................... 957 table 25.12 i 2 c bus interface timing .................................................................................. 958 table 25.13 h-udi related pi n timing............................................................................... 960 table 25.14 usb module cloc k timing .............................................................................. 962 table 25.15 usb transceive r timing .................................................................................. 963 table 25.16 a/d converter char acteristic s .......................................................................... 965
rev. 4.00 sep. 14, 2005 page l of l appendix table a.1 pin states in reset state, power do wn mode, and bus-released states when other functio n is sele cted.......................................................................... 967 table a.2 pin states in reset state, power do wn mode, and bus-released states when i/o port is select ed..................................................................................... 971
section 1 overview rev. 4.00 sep. 14, 2005 page 1 of 982 rej09b0023-0400 section 1 overview this lsi is a single-chip risc microprocessor that in tegrates a renesas technology original 32- bit superh risc engine architecture cpu with a digital signal processing (dsp) extension as its core, with 16-kbyte of cache memory, 16-kbyte of an on-chip x/y memory, and peripheral functions required for system configuration such as an interrupt controller. this lsi comes in 256- pin package. high-speed data transfers can be formed by an on-chip direct memory access controller (dmac), and an external memory access s upport function enables direct co nnection to different kinds of memory. this lsi also supports powerful peripher al functions such as usb function and serial communication inte rface with fifo. 1.1 features the features of this lsi are listed in table 1.1. table 1.1 features items specification cpu ? renesas technology original superh architecture ? compatible with sh-1, sh-2 and sh-3 at object code level ? 32-bit internal data bus ? support of an abundant register-set ? sixteen 32-bit general registers (eight 32-bit bank registers) ? eight 32-bit control registers ? four 32-bit system registers ? risc-type instruction set ? instruction length: 16-bit fixed length for improved code efficiency ? load/store architecture ? delayed branch instructions ? instruction set based on c language ? instruction execution time: one inst ruction/cycle for basic instructions ? logical address space: 4gbytes ? five-stage pipeline
section 1 overview rev. 4.00 sep. 14, 2005 page 2 of 828 rej09b0023-0400 items specification dsp ? mixture of 16-bit and 32-bit instructions ? 32-/40-bit internal data paths ? multiplier, alu, barrel shifter and dsp register ? large dsp data registers  six 32-bit data registers  two 40-bit data registers ? extended harvard architecture for dsp data bus  two data buses  one instruction bus ? max. four parallel operations: al u, multiply, and two load or store ? two addressing units to generate addresses for two memory access ? dsp data addressing modes: increment, indexing (with or without modulo addressing) ? zero-overhead repeat loop control ? conditional execution instructions clock pulse generator (cpg) ? clock mode: input clock can be selected from external input (extal or ckio) or crystal oscillator ? three types of clocks generated:  cpu clock: maximum 100 mhz  bus clock: maximum 50 mhz  peripheral clock: maximum 33 mhz ? power-down modes:  sleep mode  standby mode  module standby mode ? three types of clock modes (selectable pll2 2 / 4, clock / crystal oscillator) watchdog timer ? on-chip one-channel watchdog timer ? select from operation in watchdog-timer or interval-timer mode. ? interrupt generation is supported for the interval-timer mode.
section 1 overview rev. 4.00 sep. 14, 2005 page 3 of 982 rej09b0023-0400 items specification cache memory ? 16-kbyte cache, mixed instruction/data ? 256 entries, 4-way set associative, 16-byte block length ? write-back, write-through, lru replacement algorithm ? 1-stage write-back buffer ? maximum 2 ways of the cache can be locked x/y memory ? three independent read/write ports  8-/16-/32-bit access from the cpu  maximum two 16-bit accesses from the dsp  8-/16-/32-bit access from the dmac ? total memory: 16-kbyte (xram: 8-kbyte, yram: 8-kbyte) interrupt controller (intc) ? nine external interrupt pins ( nmi , irq7 to irq0 ) ? on-chip peripheral interrupts: prio rity level set for each module ? supports soft vector mode user break controller (ubc) ? addresses, data values, type of access, and data size can all be set as break conditions ? supports a sequential break function ? two break channels
section 1 overview rev. 4.00 sep. 14, 2005 page 4 of 828 rej09b0023-0400 items specification bus state controller (bsc) ? physical address space divided into eight areas, four areas (area 0, areas 2 to 4), each a maximum of 64 mbytes and other four areas (areas 5a, 5b, areas 6a, 6b), each a maximum of 32 mbytes ? the following features settabl e for each area independently  bus size (8, 16, or 32 bits), but different support size by each areas  number of wait cycles (wait read/write settable in dependently area exists)  idle wait cycles (same area/another area)  specifying the memory to be connected to each area enables direct connection to sram, sdram, burst rom, address/data mpx mode supporting area exists  outputs chip select signal ( cs0 , cs2 to cs4 , cs5a/b , cs6a/b ) for corresponding area (selectable for programming cs assert/negate timing) ? sdram refresh function  supports auto-refresh and self-refresh mode ? sdram burst access function ? area 2/3 enables connection to different sdram (size/latency) direct memory access controller (dmac) ? number of channels: four channels (two channels can accept external requests) ? two types of bus modes  cycle steal mode and burst mode ? interrupt can be requested to the cpu at completion of data transfer ? supports intermittent mode (16/64 cycles) user debugging interface (h-udi) ? e10a emulator support ? jtag-standard pin assignment ? realtime branch trace
section 1 overview rev. 4.00 sep. 14, 2005 page 5 of 982 rej09b0023-0400 items specification advanced user debugger (aud) ? six output pins ? trace of branch source/destination address ? window data trace function ? full trace function  all trace data can be output by stalling the cpu even when the trace data is not output in time ? real-time trace function  function to output trace data that can be output at the range not to stall the cpu multi-function timer pulse unit (mtu) ? maximum 16-pulse input/output ? selection of 8 counter input clocks for each channel ? the following operations can be set for each channel:  waveform output at compare match  input capture function  counter clear operation  a maximum 12-phase pwm output is possible in combination with synchronous operation ? buffer operation settable for channels 0,3,and 4 ? phase counting mode settable independently for each of channels 1 and 2 ? cascade connection operation ? fast access via internal 16-bit bus ? 23 interrupt sources ? automatic transfer of register data ? a/d converter conversion st art trigger can be generated ? module standby mode can be set
section 1 overview rev. 4.00 sep. 14, 2005 page 6 of 828 rej09b0023-0400 items specification compare match timer (cmt) ? 16-bit counter 2 channels ? selection of four clocks ? interrupt request or dma transfer request can be generated by compare-match serial communication interface with fifo (scif) ? 3 channels ? asynchronous mode or clock synchronous mode can be selected ? simultaneous transmission/rec eption (full-duplex) capability ? built-in dedicated baud rate generator ? separate 16-stage fifo registers for transmission and reception ? dedicated modem control function (asynchronous mode) i/o ports ? input or output can be selected for each bits usb function module ? conforming to the usb standard ? corresponds mode of usb internal transceiver or external transceiver ? supports control (endpoint 0), balk transmission (endpoint 1, 2), interrupt (endpoint 3) ? supports usb standard command and transaction class or vendor command in firmware ? fifo buffer for end point (128-byte/endpoint) ? module input clock: 48mhz. either self-powered or bus-powered mode can be selected. i 2 c bus interface (iic2) ? one channel ? conforms to the phillips i 2 c bus interface specification. ? master/slave mode supported ? continuous transmission/reception supported ? either the i 2 c bus format or clock synch ronous serial format is selectable. a/d converter ? 10 bits8 lsb, 8 channels ? input range: 0 to avcc (max. 3.6v) u memory ? three independent read/write ports  8-/16-/32-bit access from the cpu  8-/16-/32-bit access from the dsp  8-/16-bit access from the dmac ? total memory: 64-kbyte
section 1 overview rev. 4.00 sep. 14, 2005 page 7 of 982 rej09b0023-0400 1.2 block diagram the block diagram of this lsi is shown in figure1.1. x/y memory sh3 cpu mtu cmt scif iic2 h-udi usb dsp ubc aud adc bsc dmac u memory cache intc cpg/ wdt external bus interface y-bus i-bus x-bus l-bus peripheral-bus i/o port [legend] adc: aud: bsc: cache: cmt: cpg/wdt: cpu: dmac: a/d converter advanced user debugger bus state controller cache memory compare match timer clock pulse generator/watch dog timer central processing unit direct memory access controller dsp: h-udi: intc: scif: ubc: mtu: usb : iic2: digital signal processor user debugging interface interrupt controller serial communication interface user break controller multi-function timer pulse unit usb function module i 2 c bus interface figure 1.1 block diagram
section 1 overview rev. 4.00 sep. 14, 2005 page 8 of 828 rej09b0023-0400 1.3 pin assignments the pin assignments of this lsi is shown in figure 1.2. 1 a b c d e f g h j k l m n p v w y r t u a b c d e f g h j k l m n p v w y r t u 2 3 4 5 6 7 8 9 1011121314151617181920 1 2 3 4 5 6 7 8 9 10111213141516171819 20 SH7641 bga-256 (top view) figure 1.2 pin assignments (bga-256)
section 1 overview rev. 4.00 sep. 14, 2005 page 9 of 982 rej09b0023-0400 1.4 pin functions table 1.2 summarizes the pin functions. table 1.2 pin functions no. (bga256) pin name description b2 d7 data bus c2 d6 data bus d2 d5 data bus b1 d4 data bus e2 d3 data bus e3 d2 data bus c1 vssq ground for i/o circuits (0v) d3 d1 data bus d1 vccq power supply for i/o circuits (3.3v) e4 d0 data bus f2 cs3 /pta[3] chip select 3/port a f3 vss ground (0v) e1 cs2 /pta[2] chip select 2/port a f4 vcc power supply (1.8v) g2 uclk/ptb[0] usb external input clock/port b g3 vbus/ptb[1] usb pow er detection/port b f1 suspnd/ptb[2] usb suspend/port b g4 xvdata/ptb[3] receive data input fr om usb differential receiver/port b h2 txenl/ptb[4] usb output enable/port b h3 vccq power supply for i/o circuits (3.3v) * 3 g1 dp d+ h1 dm d- h4 vssq power supply for us i/o circuits (0v) * 3 j3 txdmns/ptb[5] d- transmit output for usb transceiver/port b j2 txdpls/ptb[6] d+ transmit output for usb transceiver/port b j4 dmns/ptb[7] usb d- input from receiver/port b
section 1 overview rev. 4.00 sep. 14, 2005 page 10 of 828 rej09b0023-0400 no. (bga256) pin name description j1 dpls/ptb[8] usb d+ input from receiver/port b k3 vss ground (0v) k2 a18 address bus k4 vcc power supply (1.8v) k1 a19/pta[8] address bus/port a l1 a20/pta[9] address bus/port a l4 a21/pta[10] address bus/port a m1 a22/pta[11] address bus/port a l3 a23/pta[12] address bus/port a l2 a24/pta[13] address bus/port a m4 vssq ground for i/o circuits (0v) n1 audck aud clock m3 vccq power supply for i/o circuits (3.3v) m2 a25/pta[14] address bus/port a n4 audata[0]/ptj[8] aud data/port j p1 audata[1]/ptj[9] aud data/port j n3 audata[2]/ptj[10] aud data/port j n2 audata[3]/ptj[11] aud data/port j p4 audsync /ptj[12] aud synchronized/port j r1 tck test clock p3 tdi test data input t1 tdo test data output r4 tms test mode select p2 trst test reset r3 nmi nonmaskable interrupt request u1 irq0 /ptj[0] external interrupt request/port j t4 vcc power supply (1.8v) r2 irq1 /ptj[1] external interrupt request/port j u4 vss ground (0v) v1 vssq ground for i/o circuits (0v) u2 irq2 /ptj[2] external interrupt request/port j
section 1 overview rev. 4.00 sep. 14, 2005 page 11 of 982 rej09b0023-0400 no. (bga256) pin name description w1 vccq power supply for i/o circuits (3.3v) v3 irq3 /ptj[3] external interrupt request/port j t2 irq4 /ptj[4] external interrupt request/port j t3 irq5 /ptj[5] external interrupt request/port j u3 irq6 /ptj[6] external interrupt request/port j v2 irq7 /ptj[7] external interrupt request/port j y1 sck0/pth[0] serial clock 0/port h w2 cts0 /pth[1] transmit clear 0/port h w3 txd0/pth[2] transmit data 0/port h w4 rxd0/pth[3] receive data 0/port h y2 rts0 /pth[4] transmit request 0/port h w5 sck1/pth[5] seri al clock 1/port h v5 cts1 /pth[6] transmit clear 1/port h y3 txd1/pth[7] transmit data 1/port h v4 rxd1/pth[8] receive data 1/port h y4 rts1 /pth[9] transmit request 1/port h u5 sck2/pth[10] serial clock 2/port h w6 cts2 /pth[11] transmit clear 2/port h v6 vss ground (0v) y5 txd2/pth[12] transmit data 2/port h u6 vcc power supply (1.8v) w7 rxd2/pth[13] receive data 2/port h v7 vccq power supply for i/o circuits (3.3v) y6 rts2 /pth[14] transmit request 2/port h u7 vssq ground for i/o circuits (0v) w8 tioc4d/pte[0] timer input output 4d/port e v8 tioc4c/pte[1] timer input output 4c/port e y7 tioc4b/pte[2] timer input output 4b/port e u8 tioc4a/pte[3] timer input output 4a/port e y8 tioc3d/pte[4] timer input output 3d/port e v9 tioc3b/pte[6] timer input output 3b/port e
section 1 overview rev. 4.00 sep. 14, 2005 page 12 of 828 rej09b0023-0400 no. (bga256) pin name description w9 tioc3c/pte[5] timer input output 3c/port e u9 tioc3a/pte[7] timer input output 3a/port e y9 tioc2b/pte[8] timer input output 2b/port e v10 vss ground (0v) w10 tioc2a/pte[9] timer input output 2a/port e u10 vcc power supply (1.8v) y10 tioc1b/pte[10] timer input output 1b/port e y11 tioc1a/pte[11] timer input output 1a/port e u11 tioc0d/pte[12] timer input output 0d/port e y12 tioc0c/pte[13] timer input output 0c/port e v11 tioc0b/pte[14] timer input output 0b/port e w11 tioc0a/pte[15] timer input output 0a/port e u12 vssq ground for i/o circuits (0v) y13 tclkd/ptf[8] timer clock input d/port f v12 vccq power supply for i/o circuits (3.3v) w12 tclkc/ptf[9] timer clock input c/port f u13 tclkb/ptf[10] timer clock input b/port f y14 tclka/ptf[11] timer clock input a/port f v13 poe0 /ptf[12] port output enable input 0/port f w13 poe1 /ptf[13] port output enable input 1/port f u14 poe2 /ptf[14] port output enable input 2/port f y15 poe3 /ptf[15] port output enable input 3/port f v14 ptf[0] port f y16 ptf[1] port f u15 ptf[2] port f w14 ptf[3] port f v15 ptf[4] port f y17 ptf[5] port f u16 vcc power supply (1.8v) w15 ptf[6] port f u17 vss ground (0v)
section 1 overview rev. 4.00 sep. 14, 2005 page 13 of 982 rej09b0023-0400 no. (bga256) pin name description y18 vssq ground for i/o circuits (0v) w17 ptf[7] port f y19 vccq power supply for i/o circuits (3.3v) v18 ptg[8] port g w16 scl/ptg[9] serial clock/port g * 2 v16 sda/ptg[10] serial data/port g * 2 v17 ptg[11] port g w18 ptg[12] port g y20 ptg[13] port g w19 avss (ad) ground for a/d (0v) v19 an[0]/ptg[0] a/d converter input/port g * 2 u19 an[1]/ptg[1] a/d converter input/port g* 2 w20 an[2]/ptg[2] a/d converter input/port g * 2 t19 an[3]/ptg[3] a/d converter input/port g* 2 t18 an[4]/ptg[4] a/d converter input/port g* 2 v20 an[5]/ptg[5] a/d converter input/port g * 2 u18 an[6]/ptg[6] a/d converter input/port g* 2 u20 avcc (ad) power supply for a/d (3.3v) t17 an[7]/ptg[7] a/d converter input/port g* 2 r19 vccq * 1 power supply for i/o circuits (3.3v) * 1 r18 vss ground (0v) t20 dreq0 /ptc[9] dma request/port c r17 vcc power supply (1.8v) p19 dreq1 /ptc[10] dma request/port c p18 status0/ptc[14] pr ocessor status/port c r20 status1/ptc[15] pr ocessor status/port c p17 breq /ptc[6] bus request/port c n19 back /ptc[7] bus acknowledge/port c n18 vccq * 1 power supply for i/o circuits (3.3v) * 1 p20 vccq * 1 power supply for i/o circuits (3.3v) * 1 n17 asebrkak /ptc[13] ase brake acknowledge/port c
section 1 overview rev. 4.00 sep. 14, 2005 page 14 of 828 rej09b0023-0400 no. (bga256) pin name description n20 resetp power ? on reset request m18 vccq power supply for i/o circuits (3.3v) m19 vssq ground for i/o circuits (0v) m17 xtal clock oscillator pin m20 extal external clock/crystal oscillator pin l18 vss ground (0v) l19 resetm manual reset request l17 vcc power supply (1.8v) l20 asemd0 ase mode k20 vss(pll2) ground for pll 2 (0v) k17 vcc(pll2) power supply for pll 2 (1.8v) j20 vcc(pll1) power supply for pll 1 (1.8v) k18 vss(pll1) ground for pll 1 (0v) k19 md3 bus width set for area 0 j17 md2 clock mode set h20 vccq * 1 power supply for i/o circuits (3.3v) * 1 j18 md0 clock mode set j19 cs6b /ptc[4] chip select 6b/port c h17 vssq ground for i/o circuits (0v) g20 cs6a /ptc[3] chip select 6a/port c h18 vccq power supply for i/o circuits (3.3v) h19 cs5b /ptc[2] chip select 5b/port c g17 cs5a /ptc[1] chip select 5a/port c f20 cs4 /ptc[0] chip select 4/port c g18 wait hardware wait request e20 cs0 chip select 0 f17 bs bus cycle start g19 tend/ptc[8] dma transfer end/port c f18 frame /ptc[5] frame output/port c d20 rd read strobe e17 vcc power supply (1.8v)
section 1 overview rev. 4.00 sep. 14, 2005 page 15 of 982 rej09b0023-0400 no. (bga256) pin name description f19 dack0 /ptc[11] dma request acknowledge/port c d17 vss ground (0v) c20 vssq ground for i/o circuits (0v) d19 dack1 /ptc[12] dma request acknowledge/port c b20 vccq power supply for i/o circuits (3.3v) c18 d31/ptd[15] data bus/port d e19 d30/ptd[14] data bus/port d e18 d29/ptd[13] data bus/port d d18 d28/ptd[12] data bus/port d c19 d27/ptd[11] data bus/port d a20 d26/ptd[10] data bus/port d b19 d25/ptd[9] data bus/port d b18 d24/ptd[8] data bus/port d b17 d23/ptd[7] data bus/port d a19 d22/ptd[6] data bus/port d b16 d21/ptd[5] data bus/port d c16 d20/ptd[4] data bus/port d a18 vssq ground for i/o circuits (0v) c17 d19/ptd[3] data bus/port d a17 vccq power supply for i/o circuits (3.3v) d16 d18/ptd[2] data bus/port d b15 d17/ptd[1] data bus/port d c15 vss ground (0v) a16 d16/ptd[0] data bus/port d d15 vcc power supply (1.8v) b14 ckio2 system clock output c14 vccq power supply for i/o circuits (3.3v) a15 ckio system clock for i/o circuits d14 vssq ground for i/o circuits (0v) b13 rd/ wr read/write c13 vccq power supply for i/o circuits (3.3v)
section 1 overview rev. 4.00 sep. 14, 2005 page 16 of 828 rej09b0023-0400 no. (bga256) pin name description a14 we0 /dqmll d7 to d0 select signal/dqm (sdram) d13 vssq ground for i/o circuits (0v) a13 we1 /dqmlu d15 to d8 select signal/dqm (sdram) c12 casu /pta[5] cas for upper-32m-byte address/port a b12 we3 /dqmuu/ah d31 to d24 select signal/dqm (sdram)/ address hold (mpx) d12 rasu /pta[7] ras for upper-32m-byte address/port a a12 we2 /dqmul d23 to d16 select signal/dqm (sdram) c11 vss ground (0v) b11 cke/pta[1] ck enable/port a d11 vcc power supply (1.8v) a11 casl /pta[4] cas for lower-32m-byte address/port a a10 rasl /pta[6] ras for lower-32m-byte address/port a d10 a17 address bus a9 a16 address bus c10 a15 address bus b10 a14 address bus d9 a13 address bus a8 a12 address bus c9 a11 address bus b9 a10 address bus d8 vssq ground for i/o circuits (0v) a7 a9 address bus c8 vccq power supply for i/o circuits (3.3v) b8 a8 address bus d7 a7 address bus a6 a6 address bus c7 a5 address bus a5 a4 address bus d6 a3 address bus b7 a2 address bus
section 1 overview rev. 4.00 sep. 14, 2005 page 17 of 982 rej09b0023-0400 no. (bga256) pin name description c6 a1 address bus a4 a0/pta[0] address bus/port a d5 vcc power supply (1.8v) b6 d15 data bus d4 vss ground (0v) a3 vssq ground for i/o circuits (0v) b4 d14 data bus a2 vccq power supply for i/o circuits (3.3v) c3 d13 data bus b5 d12 data bus c5 d11 data bus c4 d10 data bus b3 d9 data bus a1 d8 data bus notes: treatment of unused pins: all the i/o bu ffers except ptg10, ptg9, and ptg 7 to ptg 0 (iic2 and analog pins) have weak keepers. weak-keeper circuits are provided on input/output pins, and fix the pin inputs to hi gh or low level when the pins are not driven externally. unused pins that are provided weak -keeper circuits need not to be fixed their input levels. fix unused pins that are not provi ded weak-keeper circuits to high or low level. 1. these pins are not real power supply fo r lsi, but each pin should be supplied each specified voltage for correct action. 2. weak-keeper circuits are not provided on the i/o buffer pins. accordingly, pull the pins up or down when they are not in use. furt hermore, do not apply intermediate voltages to these pins when you are using them as port input pins. 3. h3 and h4 are a pair of power-supply pins located in the nearest position to the usb module in this lsi. insert a bypass capacitor to the pair of pins to improve the electrical characteristic for the usb input/output.
section 1 overview rev. 4.00 sep. 14, 2005 page 18 of 828 rej09b0023-0400 table 1.3 lists the pin functions. table 1.3 pin functions classification symbol i/o name function vcc i power supply power supply for the internal lsi. connect all vcc pins to the system. there will be no operation if any pins are open. vss i ground ground pin. connect all vss pins to the system power supply (0v). there will be no operation if any pins are open. vccq i power supply power supply for i/o pins. connect all vccq pins to the system power supply. there will be no operation if any pins are open. power supply vssq i ground ground pin. connect all vssq pins to the system power supply (0v). there will be no operation if any pins are open. vcc (pll1) i pll1 power supply power supply for the on-chip pll1 oscillator vss (pll1) i pll1 ground ground pin for the on-chip pll1 oscillator vcc (pll2) i pll2 power supply power supply for the on-chip pll2 oscillator vcc (pll2) i pll2 ground ground pin for the on-chip pll2 oscillator extal i external clock connected to a crystal resonator. an external clock signal may also be input to the extal pin. for examples of the connection of crystal resonator or an external clock signal, see section 4, clock pulse generator (cpg). clock xtal o crystal connected to a crystal resonator. for examples of the connection of crystal resonator or an external clock signal, see section 4, clock pulse generator (cpg).
section 1 overview rev. 4.00 sep. 14, 2005 page 19 of 982 rej09b0023-0400 classification symbol i/o name function ckio o system clock supplies the system clock to external devices. clock ckio2 o system clock supplies the system clock to external devices. operating mode control md3, md2, md0 i mode set sets the operating mode. do not change values on these pins during operation. md2, md0 set the clock mode, md3 set the bus-width mode of area 0. resetp i power-on reset when low, this lsi enters the power- on reset state. resetm i manual reset when low, this lsi enters the manual reset state. status1, status0 o status output indicate that this lsi is in software standby, reset, or sleep mode. breq i bus-mastership request low when an external device requests the release of the bus mastership. system control back o bus-mastership request acknowledge indicates that the bus mastership has been released to an external device. reception of the back signal informs the device which has output the breq signal that it has acquired the bus. nmi i non-maskable interrupt non-maskable interrupt request pin. fix to high level when not in use. interrupts irq7 to irq0 i interrupt requests 7 to 0 maskable interrupt request pin. selectable as level input or edge input. the rising edge, falling edge, and both edges are selectable as edges. address bus a25 to a0 o address bus outputs addresses. data bus d31 to d0 i/o data bus 32-bit bidirectional bus. cs0 , cs2 to cs4 , cs5a , cs5b , cs6a , cs6b o chip select 0, 2 to 4, 5a, 5b, 6a, 6b chip-select signal for external memory or devices. bus control rd o read indicates reading of data from external devices.
section 1 overview rev. 4.00 sep. 14, 2005 page 20 of 828 rej09b0023-0400 classification symbol i/o name function bus control rd/ wr o read/write read/write signal bs o bus start bus-cycle start we3 /dqmuu/ ah o byte specification indicates that bits 31 to 24 of the data in the external memory or device are being written. selects d31 to d24 when sdram is connected. address hold signal for address/data multiplexed i/o. we2 /dqmul o byte specification indicates that bits 23 to 16 of the data in the external memory or device are being written. selects d23 to d16 when sdram is connected. we1 /dqmlu o byte specification indicate s that bits 15 to 8 of the data in the external memory or device are being written. selects d15 to d8 when sdram is connected. we0 /dqmll o byte specification indicate s that bits 7 to 0 of the data in the external memory or device are being written. selects d7 to d0 when sdram is connected. rasu , rasl o ras connected to the ras pin when the sdram is connected. casu , casl o cas connected to the cas pin when the sdram is connected. cke o ck enable connected to the cke pin when the sdram is connected. frame o frame signal connects the frame signal for the burst mpx-io interface. wait i wait when active, inserts a wait cycle into the bus cycles during access to the external space.
section 1 overview rev. 4.00 sep. 14, 2005 page 21 of 982 rej09b0023-0400 classification symbol i/o name function dreq0 , dreq1 i dma-transfer request input pin for external requests for dma transfer. dack0 , dack1 o dma-transfer request receive output pin for request receive, in response to external requests for dma transfer. direct memory access controller (dmac) tend0 o dma-transfer end output output pin for dma transfer end signal tck i test clock test-clock input pin. tms i test mode select inputs the test-mode select signal. tdi i test data input serial input pin for instructions and data. tdo o test data output serial output pin for instructions and data. user debugging interface (h-udi) trst i test reset initialization-signal input pin. audata3 to audata0 o aud data data output pins in aud-trace mode. audck o aud clock sync-clock output pin in aud-trace mode. advanced user debugger (aud) audsync o aud sync signal data start-position acknowledge- signal output pin in aiud-trace mode. asebrkak o break mode acknowledge indicates that the e10a emulator has entered its break mode. for the connection with the e10a, see the SH7641 e10a emulator user's manual (tentative title). e10a interface asemd0 i ase mode sets the ase mode. scl i/o serial clock pin seri al clock input/output pin i 2 c bus interface 2 sda i/o serial data pin seri al data input/output pin
section 1 overview rev. 4.00 sep. 14, 2005 page 22 of 828 rej09b0023-0400 classification symbol i/o name function tclka tclkb tclkc tclkd i clock input external clock input pins tioc0a tioc0b tioc0c tioc0d i/o input capture/ output compare match the tgra_0 to tgrd_0 input capture input/output compare output/pwm output pins. tioc1a tioc1b i/o input capture/ output compare match the tgra_1 to tgrb_1 input capture input/output compare output/pwm output pins. multi function timer- pulse unit (mtu) tioc2a tioc2b i/o input capture/ output compare match the tgra_2 to tgrb_2 input capture input/output compare output/pwm output pins. tioc3a tioc3b tioc3c tioc3d i/o input capture/ output compare match the tgra_3 to tgrd_3 input capture input/output compare output/pwm output pins. tioc4a tioc4b tioc4c tioc4d i/o input capture/ output compare the tgra_4 to tgrb_4 input capture input/output compare output/pwm output pins port output enable (poe) poe3 to poe0 i port output enable request signal input to set the high current pins to the high impedance status sck0 sck1 sck2 i/o serial clock clock input/output pins rxd0 rxd1 rxd2 i received data data input pins txd0 txd1 txd2 o transmitted data data output pins rts0 rts1 rts2 i/o request to send request to send serial communication interface with fifo (scif) cts0 cts1 cts2 i/o clear to send clear to send
section 1 overview rev. 4.00 sep. 14, 2005 page 23 of 982 rej09b0023-0400 classification symbol i/o name function xvdata i data input input pin for receive data from usb differential receiver usb function module dpls i d+ input input pin for d+ signal from usb receiver dmns i d- input input pin for d- signal from usb receiver txdpls o d+ output d+ transmit output pin to usb transceiver txdmns o d- output d- transmit output pin to usb transceiver txenl o output enable output enable pin to usb transceiver vbus i usb power supply monitor usb cable connection monitor pin suspnd o suspend usb transceiver suspend state output pin uclk i usb clock usb clock input pin (48 mhz input) dp i/o d+ input/output input/output pin for d+ signal to/from transceiver dm i/o d- input/output input/out put pin for d- signal to/from transceiver a/d converter an7 to an0 i analog input pins analog input pins avcc i analog power supply for the a/d converter power supply pin for the a/d converter avss i analog ground for the a/d converter the ground pin for the a/d converter.
section 1 overview rev. 4.00 sep. 14, 2005 page 24 of 828 rej09b0023-0400 classification symbol i/o name function pta14 to pta0 i/o general purpose port 15 bits general purpose input/output pins ptb8 to ptb0 i/o general purpose port 9 bits general purpose input/output pins ptc15 to ptc0 i/o general purpose port 16 bits general purpose input/output pins. ptd15 to ptd0 i/o general purpose port 16 bits general purpose input/output pins pte15 to pte0 i/o general purpose port 16 bits general purpose input/output pins ptf15 to ptf0 i/o general purpose port 16 bits general purpose input/output pins ptg13 to ptg8 i/o ptg7 to ptg0 i general purpose port 14 bits general purpose input/output and input pins pth14 to ptg0 i/o general purpose port 15 bits general purpose input/output pins i/o ports ptj12 to ptg0 i/o general purpose port 13 bits general purpose input/output pins
section 2 cpu rev. 4.00 sep. 14, 2005 page 25 of 982 rej09b0023-0400 section 2 cpu 2.1 registers this lsi has the same registers as the sh-3. in addition, this lsi also supports the same dsp- related registers as in the sh-d sp. the basic software-accessible registers are divided into four distinct groups: ? general registers ? control registers ? system registers ? dsp registers with the exception of some dsp registers, all of these registers are 32-bit width. the general registers are accessible, with r0 to r7 banked to provide access to a separate set of r0 to r7 registers (i.e. r0 to r7_b ank0, and r0 to r7_bank1) depending on the value of the rb bit . the register bank (rb) bit in the status register (sr) defines which set of banked registers (r0 to r7_bank0 or r0 to r7_bank1) are accessed as general registers, and which are accessed only by ldc/stc instructions. the control registers can be accessed by ldc/stc instructions. control registers are: ? sr: status register ? ssr: saved status register ? spc: saved program counter ? gbr: global base register ? vbr: vector base register ? rs: repeat start register (dsp mode only) ? re: repeat end register (dsp mode only) ? mod: modulo register (dsp mode only)
section 2 cpu rev. 4.00 sep. 14, 2005 page 26 of 982 rej09b0023-0400 the system registers are accessed by the lds/sts instructions (the pc is software-accessible, but is included here because its contents are saved in, and restored from, spc in exception handling). the system registers are: ? mach: multiply and accumulate high register ? macl: multiply and accumulate low register ? pr: procedure register ? pc: program counter this section explains the usage of these registers in different modes. figures 2.1 and 2.2 show the register configuration in each processing mode. the dsp mode is switched by means of the dsp bit in the status register.
section 2 cpu rev. 4.00 sep. 14, 2005 page 27 of 982 rej09b0023-0400 31 r0_bank1* 1 , * 2 r1_bank1* 2 r2_bank1* 2 r3_bank1* 2 r4_bank1* 2 r5_bank1* 2 r6_bank1* 2 r7_bank1* 2 r0_bank0* 1 , * 3 r1_bank0* 3 r2_bank0* 3 r3_bank0* 3 r4_bank0* 3 r5_bank0* 3 r6_bank0* 3 r7_bank0* 3 r8 r9 r10 r11 r12 r13 r14 r15 sr ssr gbr mach macl vbr pr pc spc 03 1 r0_bank0* 1 , * 3 r1_bank0* 3 r2_bank0* 3 r3_bank0* 3 r4_bank0* 3 r5_bank0* 3 r6_bank0* 3 r7_bank0* 3 r0_bank1* 1 , * 2 r1_bank1* 2 r2_bank1* 2 r3_bank1* 2 r4_bank1* 2 r5_bank1* 2 r6_bank1* 2 r7_bank1* 2 r8 r9 r10 r11 r12 r13 r14 r15 sr ssr gbr mach macl vbr pr pc spc 0 notes: 1. the r0 register is used as an index register in indexed register indirect addressing mode and indexed gbr indirect addressing mode. 2. bank register accessed as a general register when the rb bit is set to 1 in the sr register. accessed only by ldc/stc instructions when the rb bit is cleared to 0. 3. bank register accessed as a general register when the rb bit is cleared to 0 in the sr register. accessed only by ldc/stc instructions when the rb bit is set to 1. (a) register configuration for dsp mode and non_dsp mode (rb = 1) (b) register configuration for dsp mode and non_dsp mode (rb = 0) figure 2.1 register configuration in each processing mode (1)
section 2 cpu rev. 4.00 sep. 14, 2005 page 28 of 982 rej09b0023-0400 39 a0g a1g 32 31 a0 a1 m0 m1 x0 x1 y0 y1 dsr ms me mod 0 (c) dsp mode register configuration (dsp = 1) figure 2.2 register configuration in each processing mode (2) register values after a reset are shown in table 2.1. table 2.1 initial register values type registers initial value * general registers r0 to r15 undefined control registers sr rb bit = 1, bl bit = 1, i3 to i0 = 1111 (h'f), the reserved bits other than bit 30 are all 0; bit 30 is 1, others undefined gbr, ssr, spc undefined vbr h'00000000 rs, re undefined mod undefined system registers mach, macl, pr undefined pc h'a0000000 dsp registers a0, a0g, a1, a1g, m0, m1, x0, x1, y0, y1 undefined dsr h'00000000 note: * initialized by a power-on or manual reset.
section 2 cpu rev. 4.00 sep. 14, 2005 page 29 of 982 rej09b0023-0400 2.1.1 general registers there are sixteen 32-bit general registers (rn), designated r0 to r15. the general registers are used for data processing and address calculation. with superh microcomputer type instructions, r0 is used as an index register. with a number of instructions, r0 is the only register that can be used. with dsp type instructions, eight of the sixteen general registers are used for addressing of x and y data memory and data memory (single data) that uses the l-bus. to access x memory, r4 and r5 are used as the x ad dress register [ax] and r8 is used as the x index register [ix]. to access y me mory, r6 and r7 are used as th e y address register [ay] and r9 is used as the y index register [iy]. to access single data that uses the l-bus, r2, r3, r4, and r5 are used as the single data ad dress register [as] and r8 is used as the single data index register [is]. figure 2.3 shows the general registers, which are identical to those of the sh3, when dsp extension is disabled. 31 r0* 1, * 2 r1* 2 r2* 2 r3* 2 r4* 2 r5* 2 r6* 2 r7* 2 r8 r9 r10 r11 r12 r13 r14 r15 0 general registers (when not in dsp mode) notes: 1. r0 functions as an index register in the indexed register-indirect addressing mode and indexed gbr-indirect addressing mode. in some instructions, only r0 can be used as the source register or destination register. 2. r0 to r7 are banked registers. sr.rb specifies bank. sr.rb = 0; bank0 is used sr.rb = 1; bank1 is used figure 2.3 general registers (not in dsp mode)
section 2 cpu rev. 4.00 sep. 14, 2005 page 30 of 982 rej09b0023-0400 on the other hand, registers r2 to r9 are also used for dsp data address calculation when dsp extension is enabled (see figure 2.4). other symbols that represent the purpose of the registers in dsp type instructions is shown in [ ]. 31 r0 r1 r2 [as] r3 [as] r4 [as, ax] r5 [as, ax] r6 [ay] r7 [ay] r8 [ix, is] r9 [iy] r10 r11 r12 r13 r14 r15 0 general registers (dsp mode enabled) x or y data transfer operation r4, 5 [ax]: address register set for x data memory. r8 [x]: index register for address register set ax. r6, 7 [ay]: address register set for y data memory. r9 [iy]: index register for address register set ay. single data transfer operation r2 to 5 [as]: address register set for memory. r8 [is]: index register for address register set as. figure 2.4 general registers (dsp mode) dsp type instructions can access x and y data me mory simultaneously. to specify addresses for x and y data memory, two address poin ter sets are provided. these are: r8[ix], r4,5[ax] for x memory access, and r9[iy], r6,7[ay] for y memory access. the symbols r2 to r9 are used by the assembler, but users can use other register names (aliases) that indicate the purpose of the register in the dsp instruction. the coding in assembler is as follows. ix: .reg (r8) the name ix is the alias for r8 . other aliases are as follows. ax0: .reg (r4) ax1: .reg (r5) ix: .reg (r8) ay0: .reg (r6)
section 2 cpu rev. 4.00 sep. 14, 2005 page 31 of 982 rej09b0023-0400 ay1: .reg (r7) iy: .reg (r9) as0: .reg (r4) ; this is optional, if another alias is required for single data transfer. as1: .reg (r5) ; this is optional, if another alias is required for single data transfer. as2: .reg (r2) as3: .reg (r3) is: .reg (r8) ; this is optional, if another alias is required for single data transfer. 2.1.2 control registers this lsi has 8 control registers: sr, ssr, spc, gbr, vbr, rs, re, and mod (figure 2.5). ssr, spc, gbr and vbr are the same as the sh-3 registers. the dsp mode is activated only when sr.dsp = 1. repeat start register rs, repeat end register re, and repeat counter rc (12-bit part of sr) and repeat control bits rf0 and rf1 are new registers and control bits which are used for repeat control. modulo register mod and modulo control bits dmx and dmy in sr are also new register and control bits. in sr, there are six additional control bits: rc11 to rc0, rf0, rf1, dmx, dmy and dsp. dmx and dmy are used for modulo addressing control. if dmx is 1, the modulo addressing mode is effective for the x memory addres s pointer, ax (r4 or r5). if dmy is 1, the modulo addressing mode is effective for the y memory address pointer, ay (r6 or r7). however, both x and y address pointers cannot be operated in modulo addressing mode even though both dmx and dmy bits are set. the case where dmx = dmy = 1 is reserved for future expansion. if both dmx and dmy are set simultaneously, the hardware will provisionally treat only the y address pointer as the modulo addressing mode pointer. modulo addressing is available for x and y data transfer operations (movx and movy), but not for a single data transfer operation (movs). rf1 and rf0 hold information on the number of repeat steps, and are set when a setrc instruction is executed. when rf1 and rf0 = 00 , the current repeat module consists of one instruction step. rf1 and rf0 = 01 means two instruction steps, rf1 and rf0 = 11 means three instruction steps, and rf1 and rf0 = 10 means the cu rrent repeat module consists of four or more instructions. although rc11 to rc0 and rf1 and rf0 can be changed by a store/load to sr, use of the dedicated manipulation instruction setrc is recommended. sr also has a 12-bit repeat counter, rc, which is us ed for efficient loop control. the repeat start register (rs) and repeat end register (re) are al so provided for loop control. they hold the start
section 2 cpu rev. 4.00 sep. 14, 2005 page 32 of 982 rej09b0023-0400 and end addresses of a loop (the contents of the rs and re registers are slightly different from the actual loop start and end addresses). the modulo register, mod, is provided to im plement modulo addressing for circular data buffering. mod holds the modulo start address (ms) and modulo end address (me). in order to access rs, re and mod, load/store (c ontrol register) instruct ions for these registers are provided. an example for rs is as follows: ldc rm,rs; rm -> rs ldc.l @rm+,rs; (rm) -> rs, rm+4 -> rm stc rs,rn; rs -> rn stc.l rs,@-rn; rn-4 -> rn, rs -> (rn) address set instructions for rs and re are also provided. ldrs @(disp,pc); disp
section 2 cpu rev. 4.00 sep. 14, 2005 page 33 of 982 rej09b0023-0400 31 0 1 rc 0-0 dsp dmy dmx m q i3 i2 i1 i0 rf1 rf0 st rb bl 28 27 16 15 13 12 11 10 9 8 7 6 5 4 3 2 1 0 sr (status register) rb bit: register bank bit; used to define the general registers. rb = 1: r0_bank1 to r7_bank1 are used as general registers. r0_bank0 to r7_bank0 accessed by ldc/stc instructions. rb = 0: r0_bank0 to r7_bank0 are used as general registers. r0_bank1 to r7_bank1 accessed by ldc/stc instructions. bl bit: block bit; used to mask exception. bl = 1: interrupts are masked (not accepted) bl = 0: interrupts are accepted rc [11:0]: 12-bit repeat counter dsp bit: dsp operation mode dsp = 1: dsp instructions (lds rm, dsr/a0/x0/x1/y0/y1, lds.l @rm+, dsr/a0/x0/x1/y0/y1, sts dsr/a0/x0/x1/y0/y1, rn, sts.l dsr/a0/x0/x1/y0/y1, @?rn, ldc rm, rs/re/mod, ldc.l @rm+, rs/re/mod, stc rs/re/mod,rn, stc.l rs/re/mod, @?rn, ldrs, ldre, setrc, movs, movx, movy, pxxx) are enabled. dsp = 0: all dsp instructions are treated as illegal instructions; only sh3 instructions are supported. dmy bit: modulo addressing enable for y side dmx bit: modulo addressing enable for x side q, m bit: used by div0u/s and div1 instructions. i [3:0]: 4-bit field indicating the interrupt request mask level. rf [1:0]: used for repeat control s bit: used by the mac instructions and dsp data. t bit: the movt, cmp/cond, tas, tst, bt, bf, sett, clrt and dt instructions use the t bit to indicate true (logic one) or false (logic zero). the addv/c, subv/c, div0u/s, div1, negc, shar/l, shlr/l, rotr/l and rotcr/l instructions also use the t bit to indicate a carry, borrow, overflow, or underflow. reserved bits: a fixed value (either 0 or 1) is read from each of the bits. when writing, write the values shown in the above register. operation is not guaranteed if a value other than that given above is written to the reserved bits. figure 2.5 control registers (1)
section 2 cpu rev. 4.00 sep. 14, 2005 page 34 of 982 rej09b0023-0400 ssr 31 0 saved status register (ssr) spc 31 0 saved program counter (spc) gbr 31 0 global base register vbr 31 0 vector base register rs 31 0 repeat start register re 31 0 repeat end register me ms 31 16 15 0 modulo register mod me: modulo end address, ms: modulo start address saved status register (ssr) stores current sr value at time of exception to indicate processor status when returning to instruction stream from exception handler. saved program counter (spc) stores current pc value at time of exception to indicate return address on completion of exception handling. global base register (gbr) stores base address of gbr-indirect addressing mode. the gbr-indirect addressing mode is used for data transfer and logical operations on the on-chip peripheral module register area. vector base register (vbr) stores base address of exception vector area. repeat start register (rs) used in dsp mode only. indicates start address of repeat loop. repeat end register (re) used in dsp mode only. indicates address of repeat loop end. modulo register (mod) used in dsp mode only. md[31:16]: me: modulo end address, md[15:0]: modulo start address. in x/y operand address generation, the cpu compares the address with me, and if it is the same, loads ms in either the x or y operand address register (depending on bits dmx and dmy in the sr register). figure 2.5 control registers (2)
section 2 cpu rev. 4.00 sep. 14, 2005 page 35 of 982 rej09b0023-0400 2.1.3 system registers this lsi has four system registers, macl, mach, pr and pc (figure 2.6). mach macl 31 0 pr 31 0 pc 31 0 multiply and accumulate high and low registers (mach and macl) store the results of multiplicationand accumulation operations. procedure register (pr) stores the subroutine procedure return address. program counter (pc) indicates the start address of the current instruction. figure 2.6 system registers the dsr, a0, x0, x1, y0 and y1 registers are also treated as system registers. therefore, instructions for data transfer between general regi sters and system register s are supported for these registers. 2.1.4 dsp registers this lsi has eight data registers and one control register as dsp registers (figure 2.7). the data registers are 32-bit width with the exception of re gisters a0 and a1. regist ers a0 and a1 include 8 guard bits (fields a0g and a1g), giving them a total width of 40 bits. three kinds of operation access the ds p data registers. the first is dsp data processing. when a dsp fixed-point data operation uses a0 or a1 as the source register, it uses the guard bits (bits 39 to 32). when it uses a0 or a1 as the destination register, guard bits 39 to 32 are valid. when a dsp fixed-point data operation uses a dsp register other than a0 or a1 as the source register, it sign-extends the source value to bits 39 to 32. when it uses one of these registers as the destination register, bits 39 to 32 of the result are discarded. the second kind of operation is an x or y da ta transfer operation, "movx.w" or "movy.w". this operation accesses the x and y memories through the 16-bit x and y data buses (figure 2.8). the register to be loaded or stored by this operation always comprises the upper 16 bits (bits 31 to 16). x0 or x1 can be the destination of an x memory load and y0 or y1 can be the destination of a y memory load, but no other register can be the destination register in this operation.
section 2 cpu rev. 4.00 sep. 14, 2005 page 36 of 982 rej09b0023-0400 when data is read into the upper 16 bits of a register (bits 31 to 16), the lower 16 bits of the register (bits 15 to 0) are automa tically cleared. a0 and a1 can be stored in the x or y memory by this operation, but no other registers can be stored. the third kind of operation is a single-data transfer instructio n, "movs.w" or "movs.l". these instructions access any memory location through the ldb (figure 2.8). all dsp registers connect to the ldb and can be the source or destination register of the data transfer. these instructions have word and longword access modes. in word mode, registers to be loaded or stored by this instruction comprise the upper 16 bits (bits 31 to 16) for dsp registers except a0g and a1g. when data is loaded into a register other than a0g and a1g in word mode, the lower half of the register is cleared. when a0 or a1 is used, the data is sign-extended to bits 39 to 32 and the lower half is cleared. when a0g or a1g is the destination register in word mode, data is loaded into an 8-bit register, but a0 or a1 is not cleared. in longword mode, when the destination register is a0 or a1, it is sign-extended to bits 39 to 32. tables 2.2 and 2.3 show the data type of registers used in dsp instructions. some instructions cannot use some registers shown in the tables because of instruction code limitations. for example, pmuls can use a1 as the source register, but cannot use a0. these tables ignore details of register selectability.
section 2 cpu rev. 4.00 sep. 14, 2005 page 37 of 982 rej09b0023-0400 table 2.2 destination regi ster in dsp instructions guard bits register bits registers instructions 39 32 31 16 15 0 a0, a1 dsp fixed-point, psha, pmuls sign-extended 40-bit result integer, pdmsb sign-extended 24-bit result cleared logical, pshl cleared 16-bit result cleared data transfer movs.w sign-extended 16-bit data cleared movs.l sign-extended 32-bit data a0g, a1g movs.w data no update data transfer movs.l data no update dsp fixed-point, psha, pmuls 32-bit result x0, x1 y0, y1 m0, m1 integer, logical, pdmsb, pshl 16-bit result cleared movx/y.w, movs.w 16-bit result cleared data transfer movs.l 32-bit data
section 2 cpu rev. 4.00 sep. 14, 2005 page 38 of 982 rej09b0023-0400 table 2.3 source register in dsp operations guard bits register bits registers instructions 39 32 31 16 15 0 a0, a1 dsp fixed-point, pdmsb, psha 40-bit data integer 24-bit data logical, pshl, pmuls 16-bit data movx/y.w, movs.w 16-bit data data transfer movs.l 32-bit data a0g, a1g movs.w data data transfer movs.l data dsp fixed-point, pdmsb, psha sign* 32-bit data x0, x1 y0, y1 m0, m1 integer sign * 16-bit data logical, pshl, pmuls 16-bit data movs.w 16-bit data data transfer movs.l 32-bit data note: * the data is sign-extended and input to the alu.
section 2 cpu rev. 4.00 sep. 14, 2005 page 39 of 982 rej09b0023-0400 313239 a0 a0g a1g a1 m0 m1 x0 x1 y0 y1 01234567 dc cs [2:0] vnzgt 8 31 0 (a) dsp data registers (b) dsp status register (dsr) reset status dsr: all zeros others: undefined figure 2.7 dsp registers a0g 32 0 39 31 16 a0 a1 m0 m1 x0 x1 y0 y1 07 a1g dsr 16 bits 16 bits 8 bits 32 bits ldb xdb ydb movx.w movs.w, movs.l movs.w, movs.l movy.w figure 2.8 connections of dsp registers and buses
section 2 cpu rev. 4.00 sep. 14, 2005 page 40 of 982 rej09b0023-0400 the dsp unit has one control register, the dsp status register (dsr). dsr ho lds the status of dsp data operation results (zero, negative, and so on) and has a dc bit which is similar to the t bit in the cpu. the dc bit indicates one of the status flags. a dsp data processing instruction controls its execution based on the dc bit. this control affects only the operations in the dsp unit; it controls the update of dsp registers only. it cannot control operations in the cpu, such as address register updating and load/store operations. control bits cs2 to cs0 specify the condition to be reflected in the dc bit. unconditional dsp type data operations, except pmuls, movx, movy and movs, update the condition flags and dc bit, but no cpu instructions, including mac instructions, update the dc bit. conditional dsp type instructions do not update dsr either.
section 2 cpu rev. 4.00 sep. 14, 2005 page 41 of 982 rej09b0023-0400 table 2.4 dsr register bits bits name (abbreviation) function 31 to 8 reserved bits 0: always read as 0; always use 0 as the write value 7 signed greater than bit (gt) indicates that the operation result is positive (except 0), or that operand 1 is greater than operand 2 1: operation result is posit ive, or operand 1 is greater than operand 2 6 zero bit (z) indicates that the oper ation result is zero (0), or that operand 1 is equal to operand 2 1: operation result is zero (0), or operands are equal 5 negative bit (n) indicates that the op eration result is negative, or that operand 1 is smaller than operand 2 1: operation result is negat ive, or operand 1 is smaller than operand 2 4 overflow bit (v) indicates that the operation result has overflowed 1: operation result has overflowed 3 to 1 condition select bits (cs) designat e the mode for selecting the operation result status to be set in the dc bit do not set these bits to 110 or 111 000: carry/borrow mode 001: negative value mode 010: zero mode 011: overflow mode 100: signed greater mode 101: signed greater than or equal to mode 0 dsp condition bit (dc) sets the stat us of the operation result in the mode designated by the cs bits 0: designated mode status has not occurred (false) 1: designated mode status has occurred note: after execution of a paddc/psubc instructi on, the dc bit sets the status of the operation result in carry/borrow mode regardless of the cs bits.
section 2 cpu rev. 4.00 sep. 14, 2005 page 42 of 982 rej09b0023-0400 dsr is assigned as a system register and the following load/store instructions are provided: sts dsr,rn; sts.l dsr,@-rn; lds rn,dsr; lds.l @rn+,dsr; when dsr is read by an sts instruction, the upper bits (bits 31 to 8) are all 0. 2.2 data formats 2.2.1 register data format (non-dsp type) register operands are always longwords (32 bits) (figure 2.9). when the memory operand is only a byte (8 bits) or a word (16 bits), it is sign-extended into a longword when loaded into a register. 31 0 longword figure 2.9 longword operand 2.2.2 dsp-type data formats this lsi has several different data formats that depend on the instruction. this section explains the data formats for dsp type instructions. figure 2.10 shows three dsp-type data formats with different binary point positions. a cpu-type data format with the binary point to the right of bit 0 is also shown for reference. the dsp-type fixed point data format has the binary point between bit 31 and bit 30. the dsp- type integer format has the binary point between bit 16 and bit 15. the dsp-type logical format does not have a binary point. the valid data lengths of the data formats depend on the instruction and the dsp register.
section 2 cpu rev. 4.00 sep. 14, 2005 page 43 of 982 rej09b0023-0400 39 s 31 30 0 ?2 8 to +2 8 ? 2 ?31 39 s 32 31 0 ?2 23 to +2 23 ? 1 39 s s 31 30 16 15 16 15 0 ?1 to +1 ? 2 ?15 39 31 16 15 0 s 31 0 ?2 15 to +2 15 ? 1 16 15 31 22 0 ?32 to +32 16 15 s 31 21 0 ?16 to +16 16 15 s 31 30 0 ?1 to +1 ? 2 ?31 s 31 0 ?2 31 to +2 31 ? 1 dsp type fixed point dsp type integer dsp type logical with guard bits cpu type integer s: sign bit longword : binary point : does not affect the operations without guard bits with guard bits without guard bits multiplier input shift amount for arithmetic shift (psha) shift amount for logical shift (pshl) figure 2.10 data formats the shift amount for the arithmetic shift (psha) instruction has a 7-bit field that can represent values from ?64 to +63, but ?32 to +32 are valid numbers for the instruction. also the shift amount for a logical shift operation has a 6-bit field, but ?16 to +16 are valid numbers for the instruction.
section 2 cpu rev. 4.00 sep. 14, 2005 page 44 of 982 rej09b0023-0400 2.2.3 memory data formats memory data formats are classi fied into byte, word, and long word. byte data can be accessed from any address, but an address error will occur if word data starting from an address other than 2n or longword data starting from an address other than 4n is accessed. in such cases, the data accessed cannot be guara nteed (figure 2.11). 31 0 15 23 7 byte 0 byte 1 byte 2 byte 3 word 1 word 0 address a + 4 address a + 8 longword address a address a address a + 2 address a + 1 address a + 3 big-endian mode figure 2.11 byte, word , and longword alignment 2.3 features of cpu core instructions the cpu core instructions are risc-type in structions with the following features: fixed 16-bit length: all instructions have a fixed length of 16 bits. this improves program code efficiency. one instruction per state: pipelining is used, and basic instructio ns can be executed in one state. data size: the basic data size for operations is longword. byte, word, or longword can be selected as the memory access size. memory byte or word data is sign-extended and operated on as longword data. immediate data is sign-extended to longword size for arithmetic operations or zero-extended to longword si ze for logical operations.
section 2 cpu rev. 4.00 sep. 14, 2005 page 45 of 982 rej09b0023-0400 table 2.5 word data sign extension this lsi's cpu description example of other cpu mov.w @(disp,pc),r1 add r1,r0 ........ .data.w h'1234 sign-extended to 32 bits, r1 becomes h'00001234, and is then operated on by the add instruction. add.w #h'1234,r0 note: immediate data is re ferenced by @(disp,pc). load/store architecture: basic operations are executed be tween registers. in operations involving memory, data is first loaded into a register (load/store architecture). however, bit manipulation instructions such as and are executed dir ectly on memory. delayed branching: unconditional branch instructions, etc ., are executed as delayed branches. with a delayed branch instruction, the branch is made after execution of the instruction (called the slot instruction) immediately following the delayed branch instruction. this minimizes disruption of the pipeline when a branch is made. with a delayed branch, the actual branch operation occurs after execution of the slot instruction. however, instruction execution for register upda ting, etc., excluding the branch operation, is performed in delayed branch instruction delay slot instruction order. for example, even though the contents of the register holding the branch destination address are changed in the delay slot, the branch destination address remains as the register contents prior to the change. table 2.6 delayed branch instructions this lsi's cpu description example of other cpu bra trget add r1,r0 add is executed before branch to trget. add.w r1,r0 bra trget multiply/multiply-and-ac cumulate operations: a 16 16 32 multiply operation is executed in 1 to 2 states, and a 16 16 + 64 64 multiply-and-accumulate operation in 2 states. a 32 32 64 multiply operation and a 32 32 + 64 64 multiply-and-accu mulate operation are each executed in 2 to 3 states. t bit: the result of a comparison is indicated by th e t bit in the status register (sr), and a conditional branch is performed according to whether the result is true or false. processing speed has been improved by keeping the number of instructions that modify the t bit to a minimum.
section 2 cpu rev. 4.00 sep. 14, 2005 page 46 of 982 rej09b0023-0400 table 2.7 t bit this lsi's cpu description example of other cpu cmp/ge r1,r0 bt trget0 bf trget1 if r0 r1, the t bit is set. a branch is made to trget0 if r0 r1, or to trget1 if r0 < r1. cmp.w r1,r0 bge trget0 blt trget1 add #?1,r0 cmp/eq #0,r0 bt trget the t bit is not set by add. if r0 = 0, the t bit is set. a branch is made if r0 = 0. sub.w #1,r0 beq trget immediate data: byte immediate data is placed inside the instruction code. word and longword immediate data is not placed inside the instructi on code, but in a table in memory. the table in memory is referenced with an immediate data transfer instruction (mov) using pc-relative addressing mode with displacement. table 2.8 immediate data referencing type this lsi's cpu example of other cpu 8-bit immediate mov #h' 12,r0 mov.b #h'12,r0 16-bit immediate mov.w @(disp,pc),r0 ........ .data.w h'1234 mov.w #h'1234,r0 32-bit immediate mov.l @(disp,pc),r0 ........ .data.l h'12345678 mov.l #h'12345678,r0 note: immediate data is re ferenced by @(disp,pc). absolute addresses: when data is referenced by an absolu te address, the absolute address value is placed in a table in memory beforehand. usin g the method whereby imme diate data is loaded when an instruction is executed, this value is transferred to a register and the data is referenced using register indirect addressing mode.
section 2 cpu rev. 4.00 sep. 14, 2005 page 47 of 982 rej09b0023-0400 table 2.9 absolute address referencing type this lsi's cpu example of other cpu absolute address mov.l @(disp,pc),r1 mov.b @r1,r0 ........ .data.l h'12345678 mov.b @h'12345678,r0 16-bit/32-bit displacement: when data is referenced with a 16- or 32-bit di splacement, the displacement value is placed in a table in me mory beforehand. using the method whereby immediate data is loaded when an instruction is ex ecuted, this value is transferred to a register and the data is referenced using indexed register indirect addressing mode. table 2.10 displacement referencing type this lsi's cpu example of other cpu 16-bit displacement mov.w @(disp,pc),r0 mov.w @(r0,r1),r2 ........ .data.w h'1234 mov.w @(h'1234,r1),r2
section 2 cpu rev. 4.00 sep. 14, 2005 page 48 of 982 rej09b0023-0400 2.4 instruction formats 2.4.1 cpu instruction addressing modes the following table shows addressing modes and effective address calculation methods for instructions executed by the cpu core. table 2.11 addressing modes and effective addresses for cpu instructions addressing mode instruction format effective address calculation method calculation formula register direct rn effective address is register rn. (operand is register rn contents.) ? register indirect @rn effective address is register rn contents. rn rn rn register indirect with post-increment @rn+ effective address is register rn contents. a constant is added to rn after instruction execution: 1 for a byte operand, 2 for a word operand, 4 for a longword operand. rn rn 1/2/4 + rn + 1/2/4 rn after instruction execution byte: rn + 1 rn word: rn + 2 rn longword: rn + 4 rn register indirect with pre-decrement @?rn effective address is register rn contents. it is decremented by a constant beforehand: 1 for a byte operand, 2 for a word operand, 4 for a longword operand. rn 1/2/4 rn ? 1/2/4 ? rn ? 1/2/4 byte: rn ? 1 rn word: rn ? 2 rn longword: rn ? 4 rn (instruction executed with rn after calculation)
section 2 cpu rev. 4.00 sep. 14, 2005 page 49 of 982 rej09b0023-0400 addressing mode instruction format effective address calculation method calculation formula register indirect with displacement @(disp:4, rn) effective address is register rn contents with 4-bit displacement disp added. after disp is zero-extended, it is multiplied by 1 (byte), 2 (word), or 4 (longword), according to the operand size. rn 1/2/4 + disp (zero-extended) rn + disp 1/2/4 byte: rn + disp word: rn + disp 2 longword: rn + disp 4 indexed register indirect @(r0, rn) effective address is sum of register rn and r0 contents. rn r0 rn + r0 + rn + r0 gbr indirect with displacement @(disp:8, gbr) effective address is register gbr contents with 8-bit displacement disp added. after disp is zero-extended, it is multiplied by 1 (byte), 2 (word), or 4 (longword), according to the operand size. gbr 1/2/4 + disp (zero-extended) gbr + disp 1/2/4 byte: gbr + disp word: gbr + disp 2 longword: gbr + disp 4 indexed gbr indirect @(r0, gbr) effective address is sum of register gbr and r0 contents. gbr r0 gbr + r0 + gbr + r0
section 2 cpu rev. 4.00 sep. 14, 2005 page 50 of 982 rej09b0023-0400 addressing mode instruction format effective address calculation method calculation formula pc-relative with displacement @(disp:8, pc) effective address is pc with 8-bit displacement disp added. after disp is zero- extended, it is multiplied by 2 (word) or 4 (longword), according to the operand size. with a longword operand, the lower 2 bits of pc are masked. pc h'fffffffc + 2/4 & * * : with longword operand disp (zero-extended) pc + disp 2 or pc&h'fffffffc + disp 4 word: pc + disp 2 longword: pc&h'fffffffc + disp 4 pc-relative disp:8 effective address is pc with 8-bit displacement disp added after being sign- extended and multiplied by 2. pc 2 + disp (sign-extended) pc + disp 2 pc + disp 2 disp:12 effective address is pc with 12-bit displacement disp added after being sign- extended and multiplied by 2 pc 2 + disp (sign-extended) pc + disp 2 pc + disp 2 rn effective address is sum of pc and rn. pc rn + pc + rn pc + rn
section 2 cpu rev. 4.00 sep. 14, 2005 page 51 of 982 rej09b0023-0400 addressing mode instruction format effective address calculation method calculation formula immediate #imm:8 8-bit immediate data imm of tst, and, or, or xor instruction is zero-extended. ? #imm:8 8-bit immediate data imm of mov, add, or cmp/eq instruction is sign-extended. ? #imm:8 8-bit immediate data imm of trapa instruction is zero-extended and multiplied by 4. ? 2.4.2 dsp data addressing two different memory accesses are ma de with dsp instructions. the two kinds of instructions are x and y data transfer instructions (movx.w and movy.w) and single data transfer instructions (movs.w and movsl). the data addressing is different for these two kinds of instructions. an overview of the data transfer instructions is given in table 2.12. table 2.12 overview of da ta transfer instructions x/y data transfer processing (movx.w, movy.w) single data transfer processing (movs.w, movs.l) address register ax: r4, r5, ay: r6, r7 as: r2, r3, r4, r5 index register ix: r8, iy: r9 is: r8 nop/inc (+2)/index addition: post-increment nop/inc (+2, +4)/index addition: post-increment addressing ? dec (?2, ?4): pre-decrement modulo addressing possi ble not possible data bus xdb, ydb ldb data length 16 bits (word) 16/32 bits (word/longword) bus contention no yes memory x/y data memory entire memory space source register dx, dy: a0, a1 ds: a0/a1, m0/m1, x0/x1, y0/y1, a0g, a1g destination register dx: x0/x1, dy: y0/y1 ds: a0/a1, m0/m1, x0/x1, y0/y1, a0g, a1g
section 2 cpu rev. 4.00 sep. 14, 2005 page 52 of 982 rej09b0023-0400 x/y data addressing: with dsp instructions , the x and y data memory can be accessed simultaneously using the movx.w and movy.w instructions. two address pointers are provided for dsp instru ctions to enable simultaneous acces s to x and y data memory. only pointer addressing can be used with dsp instructions; immediate addressing is not available. address registers are divided into two, with register r4 or r5 functioning as the x memory address register (ax), and register r6 or r7 as the y memory address regi ster (ay). the following three kinds of addressing can be used wi th x and y data transfer instructions. 1. non-update address register addressing: the ax and ay register s are address po inters. they are not updated. 2. addition index register addressing: the ax and ay registers are address pointers. after a data tr ansfer, the value of the ix or iy register is added to each (post-increment). 3. increment address register addressing: the ax and ay registers are address pointers. af ter a data transfer, they are each incremented by 2 (post- increment). there is an index register for each address pointer. the r8 register is the index register (ix) for the x memory address register (ax), and the r9 register is the index register (iy) for the y memory address register (ay). the x and y data transfer instructions perform word-length processing, and use 16-bit access to the x/y data memory. a value of 2 is therefore added to the address regi ster in the increment processing. to perform decrementing, ?2 is set in the index register and addition index register addressing is specified. in x/y data addressing, only bits 1 to 15 of the address pointer are valid. when using x/y data addressing, 0 must always be written to bit 0 of the address pointer and index register. x/y data transfer addressing is shown in figu re 2.12. when accessing x and y memory using the x and y buses, the upper word of ax (r4 or r5) and ay (r6 or r7) is ignored. the result of @ay+ or @ay+iy is stored in the lower word of ay, while the upper word retains its original value.
section 2 cpu rev. 4.00 sep. 14, 2005 page 53 of 982 rej09b0023-0400 alu au r8[ix] r4[ax] r5[ax] r9[iy] r6[ay] r7[ay] +2 (inc) +0 (no update) +2 (inc) +0 (no update) note: three address processing methods: 1. increment 2. index register addition (ix/iy) 3. no increment post-updating is used in all cases. the address pointer can be decremented by setting in the index register. [legend] au: adder provided for dsp addressing figure 2.12 x and y data transfer addressing single data addressing: dsp instructions include two single data transfer instructions (movs.w and movs.l) that load data into, or store data from, a dsp register. with these instructions, one of registers r2 to r5 is used as the single data transfer address register (as). the following four kinds of addressing can be used with single data transfer instructions. 1. non-update address register addressing: the as register is an address pointer. it is not updated. 2. addition index register addressing: the as register is an address pointer. after a data transfer, the value of the is register is added to the as register (post-increment). 3. increment address register addressing: the as register is an address pointer. after a data transfer, the as regist er is incremented by 2 or 4 (post-increment). 4. decrement address register addressing: the as register is an address pointer. before a data transfer, ?2 or ?4 is added to the as register (i.e. 2 or 4 is s ubtracted) (pre-decrement).
section 2 cpu rev. 4.00 sep. 14, 2005 page 54 of 982 rej09b0023-0400 the r8 register is the index register (is) for the address pointer (as). single data transfer addressing is shown in figure 2.13. alu r8[is] r4[as] r5[as] ?2/?4 (dec) +2/+4 (inc) +0 (no update) r3[as] r2[as] 31 0 31 0 mab cab 31 0 note: four address processing methods: 1. no update 2. index register addition (is) 3. increment 4. decrement post-increment pre-decrement figure 2.13 single data transfer addressing modulo addressing: like other dsps, this lsi has a modulo addressing mode. address registers are updated in the same way in this mode. when the address pointer va lue reaches the preset modulo end address, the address pointer va lue becomes the modu lo start address. modulo addressing is only available for the x and y data transfer instructions (movx.w and movy.w). modulo addressing mode is specified for the x address register by setting the dmx bit in the sr register, and for the y address register by setting the dmy bit. modulo addressing is valid for either the x or the y ad dress register, only; it cannot be set for both at the same time. therefore, dmx and dmy cannot both be set simultaneously. if they are, only the dmy setting will be valid. the mod register is provided to set the start and end addresses of the modulo address area. the mod register contains ms (modulo start) and me (modulo end). an exam ple of the use of the mod register (ms and me fields) is shown below.
section 2 cpu rev. 4.00 sep. 14, 2005 page 55 of 982 rej09b0023-0400 mov.l modaddr,rn; rn=modend, modstart ldc rn,mod; me=modend, ms=modstart modaddr: .data.w mend; modend .data.w mstart; modstart modstart: .data : modend: .data the start and end addresses are specified in ms an d me, then the dmx or dmy bit is set to 1. when the x/y data transfer instruction set in dmx/dmy is executed, the address register contents before update are compared with me* 1 . if they match, modulo st art address ms is stored in the address register as the updated value* 2 . if non-update address register addressing is specified for the x/y data transfer instruction, the address pointer will not return to modulo start address ms even though the addr ess register contents match me. notes: 1. bits 1 to 15 of the address register are used for comparison. though me retains its previous value for bit 0, 0 must always be written to bit 0. 2. the ms value is stored in bits 1 to 15 of the address register. though ms retains its previous value for bit 0, 0 must always be written to bit 0. the maximum modulo size is 64-kby tes. this is sufficient to access the x and y data memory. a block diagram of modulo addressing is shown in figure 2.14. alu au r8[ix] r9[iy] r6[ay] r7[ay] +2 +0 31 0 r4[ax] r5[ax] 31 16 15 0 15 1 abx xab +2 +0 31 0 31 16 15 0 15 1 aby yab dmx dmy cont ms cmp me 15 1 15 1 instruction (movx/movy) figure 2.14 modulo addressing
section 2 cpu rev. 4.00 sep. 14, 2005 page 56 of 982 rej09b0023-0400 an example of modulo addressing is given below. ms = h'7000; me=h'7004; r4=h'a50070008; dmx = 1; dmy = 0: (modulo addressing setting for address register ax) as a result of the above settings, the r4 register changes as follows. ; r4: h'a5007000 (initial value) ; r4: h'a5007000 -> h'a5007002 ; r4: h'a5007002 -> h'a5007004 ; r4: h'a5007004 -> h'a5007000 (after reading h'a5007004, ms value is written to address register) ; r4: h'a5007000 -> h'a5007002 place the data so that the upper 16 bits of the m odulo start and end addresse s are the same. this is because the modulo star t address overwrites only the lower 16 bits of the address register. note: when addition index is the data addressing type for x and y data transfer instructions, the address pointer may exceed the me value without actually reach ing it. in this case, the address pointer will not return to the modulo start address. not only with modulo addressing, but when x and y data addressing is used, bit 0 is ignored. 0 must always be written to bit 0 of the address pointer, index register, ms, and me.
section 2 cpu rev. 4.00 sep. 14, 2005 page 57 of 982 rej09b0023-0400 dsp addressing operations: dsp addressing operations in the pipeline execution stage (ex), including modulo addressing, are shown below. if ( operation is movx.w movy.w ) { abx=ax; aby=ay; /* memory access cycle uses abx and aby. the addresses to be used have not been updated * / /* ax is one of r4,5 * / if ( dmx==0 || dmx==1 && dmy == 1 )} ax=ax+(+2 or r8[ix] or +0); /* inc,index,not-update * / else if (! not-update) ax=modulo( ax, (+2 or r8[ix]) ); /* ay is one of r6,7 * / if ( dmy==0 ) ay=ay+(+2 or r9[iy] or +0); / * inc,index,not-update * / else if (! not-update) ay=modulo( ay, (+2 or r9[iy]) ); } else if ( operation is movs.w or movs.l ) { if ( addressing is nop, inc, add-index-reg ) { mab=as; /* memory access cycle uses mab. the address to be used has not been updated * / /* as is one of r2 to r5 * / as=as+(+2 or +4 or r8[is] or +0); / * inc,index,not-update * / else { /* decrement, pre-update * / /* as is one of r2 to r5 * / as=as+(-2 or -4); mab=as; /* memory access cycle uses mab. the address to be used has been updated * / } / * the value to be added to the address register depends on addressing operations. for example, (+2 or r8[ix] or +0) means that +2 : if operation is increment r8[ix] : if operation is add-index-reg +0 : if operation is not-update * / function modulo ( addrreg, index ) { if ( adrreg[15:0]==me ) adrreg[15:0]==ms; else adrreg=adrreg+index; return addrreg; }
section 2 cpu rev. 4.00 sep. 14, 2005 page 58 of 982 rej09b0023-0400 2.4.3 cpu instruction formats table 2.13 shows the instruction formats, and the meaning of the source and destination operands, for instructions executed by the cpu core. the meaning of the operands depends on the instruction code. the following symbols are used in the table. xxxx: instruction code mmmm: source register nnnn: destination register iiii: immediate data dddd: displacement table 2.13 cpu instruction formats instruction format source operand destination operand sample instruction 0 type xxxx xxxx xxxx xxxx 15 0 ? ? nop n type xxxx xxxx xxxx nnnn 15 0 ? nnnn: register direct mov t rn control register or system register nnnn: register direct sts mach,rn control register or system register nnnn: pre- decrement register indirect stc.l sr,@-rn m type xxxx mmmm xxxx xxxx 15 0 mmmm: register direct control register or system register ldc rm,sr mmmm: post- increment register indirect control register or system register ldc.l @rm+,sr mmmm: register indirect ? jmp @rm pc-relative using rm ? braf rm
section 2 cpu rev. 4.00 sep. 14, 2005 page 59 of 982 rej09b0023-0400 instruction format source operand destination operand sample instruction mmmm: register direct nnnn: register direct add rm,rn nm type nnnn xxxx xxxx 15 0 mmmm mmmm: register direct nnnn: register indirect mov.l rm,@rn mmmm: post- increment register indirect (multiply- and-accumulate operation) nnnn: * post- increment register indirect (multiply- and-accumulate operation) mach, macl mac.w @rm+,@rn+ mmmm: post- increment register indirect nnnn: register direct mov.l @rm+,rn mmmm: register direct nnnn: pre- decrement register indirect mov.l rm,@-rn mmmm: register direct nnnn : indexed register indirect mov.l rm,@(r0,rn) md type xxxx dddd 15 0 mmmm xxxx mmmmdddd: register indirect with displacement r0 (register direct) mov.b @(disp,rm),r0 nd4 type dddd nnnn xxxx 15 0 xxxx r0 (register direct) nnnndddd: register indirect with displacement mov.b r0,@(disp,rn) nmd type nnnn xxxx dddd 15 0 mmmm mmmm: register direct nnnndddd: register indirect with displacement mov.l rm,@(disp,rn) mmmmdddd: register indirect with displacement nnnn: register direct mov.l @(disp,rm),rn note: * in multiply-and-accumula te instructions, nnnn is the source register.
section 2 cpu rev. 4.00 sep. 14, 2005 page 60 of 982 rej09b0023-0400 instruction format source operand destination operand sample instruction d type dddd xxxx 15 0 xxxx dddd dddddddd : gbr indirect with displacement r0 (register direct) mov.l @(disp,gbr),r0 r0 (register direct) dddddddd : gbr indirect with displacement mov.l @r0,@(disp,gbr) dddddddd: pc-relative with displacement r0 (register direct) mova @(disp,pc),r0 dddddddd: pc-relative ? bf label d12 type dddd xxxx 15 0 dddd dddd dddddddddddd: pc-relative ? bra label (label=disp+pc) nd8 type dddd nnnn xxxx 15 0 dddd dddddddd: pc- relative with displacement nnnn: register direct mov.l @(disp,pc),rn i type i i i i xxxx 15 0 xxxx i i i i iiiiiiii: immediate indexed gbr indirect and.b #imm,@(r0,gbr) iiiiiiii: immediate r0 (register direct) and #imm,r0 iiiiiiii: immediate ? trapa #imm ni type nnnn i i i i xxxx 15 0 i i i i iiiiiiii: immediate nnnn: register direct add #imm,rn
section 2 cpu rev. 4.00 sep. 14, 2005 page 61 of 982 rej09b0023-0400 2.4.4 dsp instruction formats this lsi includes new instructions for digital signal processing. the new instructions are of the following two kinds. 1. memory and dsp register double and single data transfer instructions (16-bit length) 2. parallel processing instructions processed by the dsp unit (32-bit length) the instruction formats ar e shown in figure 2.15. 15 16 2526 31 0 0 0 0 15 15 15 9 910 10 a field a field a field b field 111110 111101 111100 0000 1110 cpu core instructions double data transfer instructions single data transfer instructions parallel processing instructions . . . figure 2.15 dsp instruction formats
section 2 cpu rev. 4.00 sep. 14, 2005 page 62 of 982 rej09b0023-0400 double and single data transfer instructions: the format of double data transfer instructions is shown in table 2.14, and that of single data transfer instructions in table 2.15. table 2.14 double data tr ansfer instruction formats type mnemonic 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 x memory nopx 1 1 1 1 0 0 0 0 0 0 0 data movx.w @ax,dx ax dx 0 0 1 transfer movx.w @ax+,dx 1 0 movx.w @ax+ix,dx 1 1 movx.w da,@ax da 1 0 1 movx.w da,@ax+ 1 0 movx.w da,@ax+ix 1 1 y memory nopy 1 1 1 1 0 0 0 0 0 0 0 data movy.w @ay,dy ay dy 0 0 1 transfer movy.w @ay+,dy 1 0 movy.w @ay+iy,dy 1 1 movy.w da,@ay da 1 0 1 movy.w da,@ay+ 1 0 movy.w da,@ay+iy 1 1 note: ax: 0 = r4, 1 = r5 ay: 0 = r6, 1 = r7 dx: 0 = x0, 1 = x1 dy: 0 = y0, 1 = y1 da: 0 = a0, 1 = a1
section 2 cpu rev. 4.00 sep. 14, 2005 page 63 of 982 rej09b0023-0400 table 2.15 single data tr ansfer instruction formats type mnemonic 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 single movs.w @-as,ds 1 1 1 1 0 1 as ds 0:( * ) 0 0 0 0 data movs.w @as,ds 0:r4 1:( * ) 0 1 transfer movs.w @as+,ds 1:r5 2:( * ) 1 0 movs.w @as+ix,ds 2:r2 3:( * ) 1 1 movs.w ds,@-as 3:r3 4:( * ) 0 0 0 1 movs.w ds,@as 5:a1 0 1 movs.w ds,@as+ 6:( * ) 1 0 movs.w ds,@as+ix 7:a0 1 1 movs.l @-as,ds 8:x0 0 0 1 0 movs.l @as,ds 9:x1 0 1 movs.l @as+,ds a:y0 1 0 movs.l @as+ix,ds b:y1 1 1 movs.l ds,@-as c:m0 0 0 1 1 movs.l ds,@as d:a1g 0 1 movs.l ds,@as+ e:m1 1 0 movs.l ds,@as+ix f:a0g 1 1 note: * codes reserved for system use. parallel processing instructions: parallel processing instructions are provided for efficient execution of digital signal processing using the dsp unit. they are 32 bits long and allow four simultaneous processes, an alu operation, multiplication, and two data transfers. parallel processing instructions are divided into an a field and a b field. the a field defines data transfer instructions and the b field an alu operation instruction and multiply instruction. these instructions can be defined independently, and the processing is executed in parallel, independently and simultaneously. a-field parallel data transfer instructions are shown in table 2.16, and b-field alu operation instructions and multiply instructions in table 2.17.
section 2 cpu rev. 4.00 sep. 14, 2005 page 64 of 982 rej09b0023-0400 table 2.16 a-field parallel data transfer instructions nopx movx.w @ax, dx movx.w @ax+, dx movx.w @ax+ix, dx movx.w da, @ax movx.w da, @ax+ movx.w da, @ax+ix nopy movy.w @ay, dy movy.w @ay+, dy movy.w @ay+iy, dy movy.w da, @ay movy.w da, @ay+ movy.w da, @ay+iy mnemonic x memory data transfer type 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 54 3 2 1 0 y memory data transfer 11111 0 note: ax: 0 = r4, 1 = r5 ay: 0 = r6, 1 = r7 dx: 0 = x0, 1 = x1 dy: 0 = y0, 1 = y1 da: 0 = a0, 1 = a1 0 ax 0 ay 0 dx da 0 dy da 0 0 1 0 0 1 0 0 1 1 0 1 1 0 1 0 1 1 0 1 0 0 1 1 0 1 1 0 1 0 1 1 0 1 b field b field
section 2 cpu rev. 4.00 sep. 14, 2005 page 65 of 982 rej09b0023-0400 table 2.17 b-field alu opera tion instructions and multiply instructions (1) pshl #imm, dz psha #imm, dz reserved pmuls se, sf, dg reserved psub sx, sy, du pmuls se, sf, dg padd sx, sy, du pmuls se, sf, dg reserved psubc sx, sy, dz paddc sx, sy, dz pcmp sx, sy reserved reserved reserved pabs sx, dz prnd sx, dz pabs sy, dz prnd sy, dz reserved mnemonic imm. shift type 0:(* 1 ) 1:(* 1 ) 2:(* 1 ) 3:(* 1 ) 4:(* 1 ) 5:a1 6:(* 1 ) 7:a0 8:x0 9:x1 a:y0 b:y1 c:m0 d:(* 1 ) e:m1 f:(* 1 ) 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 6-operand parallel instructions 3-operand instructions 111110 0 0 0 0 0 0 0 0 1 0 0 0 0 1 1 1 1 0 0 0 0 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 1 ?16 < = imm < = +16 ?32 < = imm < = +32 se sf sx sy dg du 0:x0 1:x1 2:y0 3:a1 0:y0 1:y1 2:x0 3:a1 0:x0 1:x1 2:a0 3:a1 0:y0 1:y1 2:m0 3:m1 0:m0 1:m1 2:a0 3:a1 0:x0 1:y0 2:a0 3:a1 0 0 1 1 0 1 0 1 0 0 dz dz note: 1. codes reserved for system use. a field
section 2 cpu rev. 4.00 sep. 14, 2005 page 66 of 982 rej09b0023-0400 table 2.17 b-field alu opera tion instructions and multiply instructions (2) [if cc] pshl sx, sy, dz [if cc] psha sx, sy, dz [if cc] psub sx, sy, dz [if cc] padd sx, sy, dz reserved [if cc] pand sx, sy, dz [if cc] pxor sx, sy, dz [if cc] por sx, sy, dz [if cc] pdec sx, dz [if cc] pinc sx, dz [if cc] pdec sy, dz [if cc] pinc sy, dz [if cc] pclr dz [if cc] pdmsb sx, dz reserved [if cc] pdmsb sy, dz [if cc] pneg sx, dz [if cc] pcopy sx, dz [if cc] pneg sy, dz [if cc] pcopy sy, dz reserved [if cc] psts mach, dz [if cc] psts macl, dz [if cc] plds dz, mach [if cc] plds dz, macl (* 2 ) reserved reserved mnemonic type if cc 01: 10: dct 11: dcf 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 54 3 2 1 0 conditional 3-operand instructions 111110 11 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 sx 0:x0 1:x1 2:a0 3:a1 0 0 1 1 1 1 0 0 1 0 1 0 1 * 0:(* 1 ) 1:(* 1 ) 2:(* 1 ) 3:(* 1 ) 4:(* 1 ) 5:a1 6:(* 1 ) 7:a0 8:x0 9:x1 a:y0 b:y1 c:m0 d:(* 1 ) e:m1 f:(* 1 ) dz 111111 0 0 0 0 sy 0:y0 1:y1 2:m0 3:m1 uncon- ditional if cc notes: 1. codes reserved for system use. 2. [if cc]: dct (dc bit true), dcf (dc bit false) or none (unconditional instruction) a field
section 2 cpu rev. 4.00 sep. 14, 2005 page 67 of 982 rej09b0023-0400 2.5 instruction set 2.5.1 cpu instruction set the sh-1/sh-2/sh-3 compatible instruction set consists of 67 basic instruction types divided into seven functional groups, as shown in table 2.18. tables 2.19 to 2.24 show the instruction notation, machine code, execution time, and function. table 2.18 cpu instruction types type kinds of instruction op code function number of instructions data transfer instructions 5 mov data transfer immediate data transfer peripheral module data transfer structure data transfer 39 mova effective address transfer movt t bit transfer swap upper/lower swap xtrct extraction of mi ddle of linked registers arithmetic 21 add binary addition 34 operation addc binary addition with carry instructions addv binary addition with overflow check cmp/cond comparison div1 division div0s signed division initialization div0u unsigned division initialization dmuls signed double-precision multiplication dmulu unsigned double-precision multiplication dt decrement and test exts sign extension extu zero extension mac multiply-and-accumulate, double- precision multiply-and-accumulate
section 2 cpu rev. 4.00 sep. 14, 2005 page 68 of 982 rej09b0023-0400 type kinds of instruction op code function number of instructions 21 mul double-precision multiplication (32 32 bits) 34 muls signed multiplication (16 16 bits) arithmetic operation instructions mulu unsigned multiplication (16 16 bits) neg sign inversion negc sign inversion with borrow sub binary subtraction subc binary subtraction with carry subv binary subtraction with underflow logic 6 and logical and 14 operation not bit inversion instructions or logical or tas memory test and bit setting tst logical and and t bit setting xor exclusive logical or shift 12 rotl 1-bit left rotation 16 instructions rotr 1-bit right rotation rotcl 1-bit left rotation with t bit rotcr 1-bit right rotation with t bit shal arithmetic 1-bit left shift shar arithmetic 1-bit right shift shll logical 1-bit left shift shlln logical n-bit left shift shlr logical 1-bit right shift shlrn logical n-bit right shift shad arithmetic dynamic shift shld logical dynamic shift
section 2 cpu rev. 4.00 sep. 14, 2005 page 69 of 982 rej09b0023-0400 type kinds of instruction op code function number of instructions branch instructions 9 bf conditional branch, delayed conditional branch (t = 0) 11 bt conditional branch, delayed conditional branch (t = 1) bra unconditional branch braf unconditional branch bsr branch to subroutine procedure bsrf branch to subroutine procedure jmp unconditional branch jsr branch to subroutine procedure rts return from subroutine procedure system 14 clrt t bit clear 74 control clrmac mac register clear instructions clrs s bit clear ldc load into control register lds load into system register nop no operation pref data prefetch to cache rte return from exception handling sets s bit setting sett t bit setting sleep transition to power-down mode stc store from control register sts store from system register trapa trap exception handling total: 67 188
section 2 cpu rev. 4.00 sep. 14, 2005 page 70 of 982 rej09b0023-0400 the instruction code, operation, an d number of execution states of the cpu instructions are shown in the following tables, classified by instruction type, using the format shown below. instruction instruction code operation executi on states t bit indicated by mnemonic. explanation of symbols op.sz src, dest op: operation code sz: size src: source dest: destination rm: source register rn: destination register imm: immediate data disp: displacement indicated in msb ? lsb order. explanation of symbols mmmm: source register nnnn: destination register 0000: r0 0001: r1 ......... 1111: r15 iiii: immediate data dddd: displacement * 2 indicates summary of operation. explanation of symbols , : transfer direction (xx): memory operand m/q/t: flag bits in sr &: logical and of each bit |: logical or of each bit ^: exclusive logical or of each bit ~: logical not of each bit <>n: n-bit right shift value when no wait states are inserted * 1 value of t bit after instruction is executed explanation of symbols ?: no change notes: 1. the table shows the minimum number of execution states. in practice, the number of instruction execution states will be incr eased in cases such as the following: (1) when there is contention between an instruction fetch and a data access (2) when the destination register of a load instruction (memory register) is also used by the following instruction 2. scaled ( 1, 2, or 4) according to the instruction operand size, etc.
section 2 cpu rev. 4.00 sep. 14, 2005 page 71 of 982 rej09b0023-0400 data transfer instructions table 2.19 data transfer instructions instruction instruction code operation execution states t bit mov #imm,rn 1110nnnniiiiiiii imm sign extension rn 1 ? mov.w @(disp,pc),rn 1001nnnndddddddd (disp 2 + pc) sign extension rn 1 ? mov.l @(disp,pc),rn 1101nnnndddddddd (disp 4 + pc) rn 1 ? mov rm,rn 0110nnnnmmmm0011 rm rn 1 ? mov.b rm,@rn 0010nnnnmmmm0000 rm (rn) 1 ? mov.w rm,@rn 0010nnnnmmmm0001 rm (rn) 1 ? mov.l rm,@rn 0010nnnnmmmm0010 rm (rn) 1 ? mov.b @rm,rn 0110nnnnmmmm0000 (rm) sign extension rn 1 ? mov.w @rm,rn 0110nnnnmmmm0001 (rm) sign extension rn 1 ? mov.l @rm,rn 0110nnnnmmmm0010 (rm) rn 1 ? mov.b rm,@?rn 0010nnnnmmmm0100 rn?1 rn, rm (rn) 1 ? mov.w rm,@?rn 0010nnnnmmmm0101 rn?2 rn, rm (rn) 1 ? mov.l rm,@?rn 0010nnnnmmmm0110 rn?4 rn, rm (rn) 1 ? mov.b @rm+,rn 0110nnnnmmmm0100 (rm) sign extension rn, rm + 1 rm 1 ? mov.w @rm+,rn 0110nnnnmmmm0101 (rm) sign extension rn, rm + 2 rm 1 ? mov.l @rm+,rn 0110nnnnmmmm0110 (rm) rn,rm + 4 rm 1 ? mov.b r0,@(disp,rn) 10000000nnnndddd r0 (disp + rn) 1 ? mov.w r0,@(disp,rn) 10000001nnnndddd r0 (disp 2 + rn) 1 ? mov.l rm,@(disp,rn) 0001nnnnmmmmdddd rm (disp 4 + rn) 1 ? mov.b @(disp,rm),r0 10000100mmmmdddd (disp + rm) sign extension r0 1 ? mov.w @(disp,rm),r0 10000101mmmmdddd (disp 2 + rm) sign extension r0 1 ? mov.l @(disp,rm),rn 0101nnnnmmmmdddd (disp 4 + rm) rn 1 ? mov.b rm,@(r0,rn) 0000nnnnmmmm0100 rm (r0 + rn) 1 ? mov.w rm,@(r0,rn) 0000nnnnmmmm0101 rm (r0 + rn) 1 ?
section 2 cpu rev. 4.00 sep. 14, 2005 page 72 of 982 rej09b0023-0400 instruction instruction code operation execution states t bit mov.l rm,@(r0,rn) 0000nnnnmmmm0110 rm (r0 + rn) 1 ? mov.b @(r0,rm),rn 0000nnnnmmmm1100 (r0 + rm) sign extension rn 1 ? mov.w @(r0,rm),rn 0000nnnnmmmm1101 (r0 + rm) sign extension rn 1 ? mov.l @(r0,rm),rn 0000nnnnmmmm1110 (r0 + rm) rn 1 ? mov.b r0,@(disp,gbr) 11000000dddddddd r0 (disp + gbr) 1 ? mov.w r0,@(disp,gbr) 11000001dddddddd r0 (disp 2 + gbr) 1 ? mov.l r0,@(disp,gbr) 11000010dddddddd r0 (disp 4 + gbr) 1 ? mov.b @(disp,gbr),r0 11000100dddddddd (disp + gbr) sign extension r0 1 ? mov.w @(disp,gbr),r0 11000101dddddddd (disp 2 + gbr) sign extension r0 1 ? mov.l @(disp,gbr),r0 11000110dddddddd (disp 4 + gbr) r0 1 ? mova @(disp,pc),r0 11000111dddddddd disp 4 + pc r0 1 ? movt rn 0000nnnn00101001 t rn 1 ? swap.b rm,rn 0110nnnnmmmm1000 rm swap lowest two bytes rn 1 ? swap.w rm,rn 0110nnnnmmmm1001 rm swap two consecutive words rn 1 ? xtrct rm,rn 0010nnnnmmmm1101 middle 32 bits of rm and rn rn 1 ?
section 2 cpu rev. 4.00 sep. 14, 2005 page 73 of 982 rej09b0023-0400 arithmetic operation instructions table 2.20 arithmetic operation instructions instruction instruction code operation execution states t bit add rm,rn 0011nnnnmmmm1100 rn + rm rn 1 ? add #imm,rn 0111nnnniiiiiiii rn + imm rn 1 ? addc rm,rn 0011nnnnmmmm1110 rn + rm + t rn, carry t 1 carry addv rm,rn 0011nnnnmmmm1111 rn + rm rn, overflow t 1 overflow cmp/eq #imm,r0 10001000iiiiiiii if r0 = imm, 1 t 1 comparison result cmp/eq rm,rn 0011nnnnmmmm0000 if rn = rm, 1 t 1 comparison result cmp/hs rm,rn 0011nnnnmmmm0010 if rn rm with unsigned data, 1 t 1 comparison result cmp/ge rm,rn 0011nnnnmmmm0011 if rn rm with signed data, 1 t 1 comparison result cmp/hi rm,rn 0011nnnnmmmm0110 if rn > rm with unsigned data, 1 t 1 comparison result cmp/gt rm,rn 0011nnnnmmmm0111 if rn > rm with signed data, 1 t 1 comparison result cmp/pl rn 0100nnnn00010101 if rn > 0, 1 t 1 comparison result cmp/pz rn 0100nnnn00010001 if rn 0, 1 t 1 comparison result cmp/str rm,rn 0010nnnnmmmm1100 if rn and rm have an equivalent byte, 1 t 1 comparison result div1 rm,rn 0011nnnnmmmm0100 single-step division (r n/rm) 1 calculation result div0s rm,rn 0010nnnnmmmm0111 msb of rn q, msb of rm m, m ^ q t 1 calculation result div0u 0000000000011001 0 m/q/t 1 0 dmuls.l rm,rn 0011nnnnmmmm1101 signed operation of rn rm mach, macl 32 32 64 bits 2(5) * 1 ?
section 2 cpu rev. 4.00 sep. 14, 2005 page 74 of 982 rej09b0023-0400 instruction instruction code operation execution states t bit dmulu.l rm,rn 0011nnnnmmmm0101 unsigned operation of rn rm mach, macl 32 32 4 bits 2(5) * 1 ? dt rn 0100nnnn00010000 rn ? 1 rn, if rn = 0, 1 t, else 0 t 1 comparison result exts.b rm,rn 0110nnnnmmmm1110 a byte in rm is sign-extended rn 1 ? exts.w rm,rn 0110nnnnmmmm1111 a word in rm is sign-extended rn 1 ? extu.b rm,rn 0110nnnnmmmm1100 a byte in rm is zero-extended rn 1 ? extu.w rm,rn 0110nnnnmmmm1101 a word in rm is zero-extended rn 1 ? mac.l @rm+,@rn+ 0000nnnnmmmm1111 signed operation of (rn) (rm) mac mac, rn + 4 rn, rm + 4 rm 32 32 + 64 64 bits 2(5) * 1 ? mac.w @rm+,@rn+ 0100nnnnmmmm1111 signed operation of (rn) (rm) mac mac, rn + 2 rn, rm + 2 rm 16 16 + 64 64 bits 2(5) * 1 ? mul.l rm,rn 0000nnnnmmmm0111 rn rm macl 32 32 32 bits 2(5) * 1 ? muls.w rm,rn 0010nnnnmmmm1111 signed operation of rn rm mac 16 16 32 bits 1(3) * 2 ? mulu.w rm,rn 0010nnnnmmmm1110 unsigned operation of rn rm mac 16 16 32 bits 1(3) * 2 ? neg rm,rn 0110nnnnmmmm1011 0?rm rn 1 ? negc rm,rn 0110nnnnmmmm1010 0?rm?t rn, borrow t 1 borrow sub rm,rn 0011nnnnmmmm1000 rn?rm rn 1 ? subc rm,rn 0011nnnnmmmm1010 rn?rm?t rn, borrow t 1 borrow
section 2 cpu rev. 4.00 sep. 14, 2005 page 75 of 982 rej09b0023-0400 instruction instruction code operation execution states t bit subv rm,rn 0011nnnnmmmm1011 rn?rm rn, underflow t 1 underflow notes: 1. the normal minimum num ber of execution cycles is tw o, but five cycles are required when the operation result is read from the mac register immediately after the instruction. 2. the normal minimum number of execution cycles is one, but three cycles are required when the operation result is read from t he mac register immediately after the mul instruction. logic operation instructions table 2.21 logic operation instructions instruction instruction code operation execution states t bit and rm,rn 0010nnnnmmmm1001 rn & rm rn 1 ? and #imm,r0 11001001iiiiiiii r0 & imm r0 1 ? and.b #imm,@(r0,gbr) 11001101iiiiiiii (r0 + gbr) & imm (r0 + gbr) 3 ? not rm,rn 0110nnnnmmmm0111 ~rm rn 1 ? or rm,rn 0010nnnnmmmm1011 rn | rm rn 1 ? or #imm,r0 11001011iiiiiiii r0 | imm r0 1 ? or.b #imm,@(r0,gbr) 11001111iiiiiiii (r0 + gbr) | imm (r0 + gbr) 3 ? tas.b @rn 0100nnnn00011011 if (rn) is 0, 1 t; 1 msb of (rn) 4 test result tst rm,rn 0010nnnnmmmm1000 rn & rm; if the result is 0, 1 t 1 test result tst #imm,r0 11001000iiiiiiii r0 & imm; if the result is 0, 1 t 1 test result tst.b #imm,@(r0,gbr) 11001100iiiiiiii (r0 + gbr) & imm; if the result is 0, 1 t 3 test result xor rm,rn 0010nnnnmmmm1010 rn ^ rm rn 1 ? xor #imm,r0 11001010iiiiiiii r0 ^ imm r0 1 ? xor.b #imm,@(r0,gbr) 11001110iiiiiiii (r0 + gbr) ^ imm (r0 + gbr) 3 ?
section 2 cpu rev. 4.00 sep. 14, 2005 page 76 of 982 rej09b0023-0400 shift instructions table 2.22 shift instructions instruction instruction code operation execution states t bit rotl rn 0100nnnn00000100 t rn msb 1 msb rotr rn 0100nnnn00000101 lsb rn t 1 lsb rotcl rn 0100nnnn00100100 t rn t 1 msb rotcr rn 0100nnnn00100101 t rn t 1 lsb shad rm,rn 0100nnnnmmmm1100 rm 0: rn << rm rn rm < 0: rn >> rm [msb rn] 1 ? shal rn 0100nnnn00100000 t rn 0 1 msb shar rn 0100nnnn00100001 msb rn t 1 lsb shld rm,rn 0100nnnnmmmm1101 rm 0: rn << rm rn rm < 0: rn >> rm [0 rn] 1 ? shll rn 0100nnnn00000000 t rn 0 1 msb shlr rn 0100nnnn00000001 0 rn t 1 lsb shll2 rn 0100nnnn00001000 rn << 2 rn 1 ? shlr2 rn 0100nnnn00001001 rn >> 2 rn 1 ? shll8 rn 0100nnnn00011000 rn << 8 rn 1 ? shlr8 rn 0100nnnn00011001 rn >> 8 rn 1 ? shll16 rn 0100nnnn00101000 rn << 16 rn 1 ? shlr16 rn 0100nnnn00101001 rn >> 16 rn 1 ?
section 2 cpu rev. 4.00 sep. 14, 2005 page 77 of 982 rej09b0023-0400 branch instructions table 2.23 branch instructions instruction instruction code operation execution states t bit bf label 10001011dddddddd if t = 0, disp 2 + pc pc; if t = 1, nop (where label is disp + pc) 3/1* ? bf/s label 10001111dddddddd delayed branch, if t = 0, disp 2 + pc pc; if t = 1, nop 2/1* ? bt label 10001001dddddddd delayed branch, if t = 1, disp 2 + pc pc; if t = 0, nop 3/1* ? bt/s label 10001101dddddddd if t = 1, disp 2 + pc pc; if t = 0, nop 2/1* ? bra label 1010dddddddddddd delayed branch, disp 2 + pc pc 2 ? braf rm 0000mmmm00100011 delayed branch, rm + pc pc 2 ? bsr label 1011dddddddddddd delayed branch, pc pr, disp 2 + pc pc 2 ? bsrf rm 0000mmmm00000011 delayed branch, pc pr, rm + pc pc 2 ? jmp @rm 0100mmmm00101011 delayed branch, rm pc 2 ? jsr @rm 0100mmmm00001011 delayed branch, pc pr, rm pc 2 ? rts 0000000000001011 delayed branch, pr pc 2 ? note: * one state when the br anch is not executed.
section 2 cpu rev. 4.00 sep. 14, 2005 page 78 of 982 rej09b0023-0400 system control instructions table 2.24 system control instructions instruction instruction code operation execution states t bit clrmac 0000000000101000 0 mach, macl 1 ? clrs 0000000001001000 0 s 1 ? clrt 0000000000001000 0 t 1 0 ldc rm,sr 0100mmmm00001110 rm sr 6 lsb ldc rm,gbr 0100mmmm00011110 rm gbr 4 ? ldc rm,vbr 0100mmmm00101110 rm vbr 4 ? ldc rm,ssr 0100mmmm00111110 rm ssr 4 ? ldc rm,spc 0100mmmm01001110 rm spc 4 ? ldc rm,r0_bank 0100mmmm10001110 rm r0_bank 4 ? ldc rm,r1_bank 0100mmmm10011110 rm r1_bank 4 ? ldc rm,r2_bank 0100mmmm10101110 rm r2_bank 4 ? ldc rm,r3_bank 0100mmmm10111110 rm r3_bank 4 ? ldc rm,r4_bank 0100mmmm11001110 rm r4_bank 4 ? ldc rm,r5_bank 0100mmmm11011110 rm r5_bank 1 ? ldc rm,r6_bank 0100mmmm11101110 rm r6_bank 4 ? ldc rm,r7_bank 0100mmmm11111110 rm r7_bank 4 ? ldc.l @rm+,sr 0100mmmm00000111 (rm) sr, rm + 4 rm 8 lsb ldc.l @rm+,gbr 0100mmmm00010111 (rm) gbr, rm + 4 rm 4 ? ldc.l @rm+,vbr 0100mmmm00100111 (rm) vbr, rm + 4 rm 4 ? ldc.l @rm+,ssr 0100mmmm00110111 (rm) ssr, rm + 4 rm 4 ? ldc.l @rm+,spc 0100mmmm01000111 (rm) spc, rm + 4 rm 4 ? ldc.l @rm+, r0_bank 0100mmmm10000111 (rm) r0_bank, rm + 4 rm 4 ? ldc.l @rm+, r1_bank 0100mmmm10010111 (rm) r1_bank, rm + 4 rm 4 ? ldc.l @rm+, r2_bank 0100mmmm10100111 (rm) r2_bank, rm + 4 rm 4 ? ldc.l @rm+, r3_bank 0100mmmm10110111 (rm) r3_bank, rm + 4 rm 4 ?
section 2 cpu rev. 4.00 sep. 14, 2005 page 79 of 982 rej09b0023-0400 instruction instruction code operation execution states t bit ldc.l @rm+, r4_bank 0100mmmm11000111 (rm) r4_bank, rm + 4 rm 4 ? ldc.l @rm+, r5_bank 0100mmmm11010111 (rm) r5_bank, rm + 4 rm 4 ? ldc.l @rm+, r6_bank 0100mmmm11100111 (rm) r6_bank, rm + 4 rm 4 ? ldc.l @rm+, r7_bank 0100mmmm11110111 (rm) r7_bank, rm + 4 rm 4 ? lds rm,mach 0100mmmm00001010 rm mach 1 ? lds rm,macl 0100mmmm00011010 rm macl 1 ? lds rm,pr 0100mmmm00101010 rm pr 1 ? lds.l @rm+,mach 0100mmmm00000110 (rm) mach, rm + 4 rm 1 ? lds.l @rm+,macl 0100mmmm00010110 (rm) macl, rm + 4 rm 1 ? lds.l @rm+,pr 0100mmmm00100110 (rm) pr, rm + 4 rm 1 ? nop 0000000000001001 no operation 1 ? pref @rm 0000mmmm10000011 (rm) cache 1 ? rte 0000000000101011 delayed branch, ssr/spc sr/pc 5 ? sets 0000000001011000 1 s 1 ? sett 0000000000011000 1 t 1 1 sleep 0000000000011011 sleep 4* ? stc sr,rn 0000nnnn00000010 sr rn 1 ? stc gbr,rn 0000nnnn00010010 gbr rn 1 ? stc vbr,rn 0000nnnn00100010 vbr rn 1 ? stc ssr,rn 0000nnnn00110010 ssr rn 1 ? stc spc,rn 0000nnnn01000010 spc rn 1 ? stc r0_bank,rn 0000nnnn10000010 r0_bank rn 1 ? stc r1_bank,rn 0000nnnn10010010 r1_bank rn 1 ? stc r2_bank,rn 0000nnnn10100010 r2_bank rn 1 ? stc r3_bank,rn 0000nnnn10110010 r3_bank rn 1 ? stc r4_bank,rn 0000nnnn11000010 r4_bank rn 1 ? stc r5_bank,rn 0000nnnn11010010 r5_bank rn 1 ? stc r6_bank,rn 0000nnnn11100010 r6_bank rn 1 ?
section 2 cpu rev. 4.00 sep. 14, 2005 page 80 of 982 rej09b0023-0400 instruction instruction code operation execution states t bit stc r7_bank,rn 0000nnnn11110010 r7_bank rn 1 ? stc.l sr,@?rn 0100nnnn00000011 rn?4 rn, sr (rn) 1 ? stc.l gbr,@?rn 0100nnnn00010011 rn?4 rn, gbr (rn) 1 ? stc.l vbr,@?rn 0100nnnn00100011 rn?4 rn, vbr (rn) 1 ? stc.l ssr,@?rn 0100nnnn00110011 rn?4 rn, ssr (rn) 1 ? stc.l spc,@?rn 0100nnnn01000011 rn?4 rn, spc (rn) 1 ? stc.l r0_bank, @?rn 0100nnnn10000011 rn?4 rn, r0_bank (rn) 1 ? stc.l r1_bank, @?rn 0100nnnn10010011 rn?4 rn, r1_bank (rn) 1 ? stc.l r2_bank, @?rn 0100nnnn10100011 rn?4 rn, r2_bank (rn) 1 ? stc.l r3_bank, @?rn 0100nnnn10110011 rn?4 rn, r3_bank (rn) 1 ? stc.l r4_bank, @?rn 0100nnnn11000011 rn?4 rn, r4_bank (rn) 1 ? stc.l r5_bank, @?rn 0100nnnn11010011 rn?4 rn, r5_bank (rn) 1 ? stc.l r6_bank, @?rn 0100nnnn11100011 rn?4 rn, r6_bank (rn) 1 ? stc.l r7_bank, @?rn 0100nnnn11110011 rn?4 rn, r7_bank (rn) 1 ? sts mach,rn 0000nnnn00001010 mach rn 1 ? sts macl,rn 0000nnnn00011010 macl rn 1 ? sts pr,rn 0000nnnn00101010 pr rn 1 ? sts.l mach,@?rn 0100nnnn00000010 rn?4 rn, mach (rn) 1 ? sts.l macl,@?rn 0100nnnn00010010 rn?4 rn, macl (rn) 1 ? sts.l pr,@?rn 0100nnnn00100010 rn?4 rn, pr (rn) 1 ? trapa #imm 11000011iiiiiiii pc spc, sr ssr, imm << 2 tra, vbr + h'0100 pc 8 ? note: * number of states before the chip enters the sleep state. the table shows the minimum number of cloc ks required for execution. in practice, the number of execution cycles will be increas ed if there is c ontention bet ween an instruction fetch and a data access, or if t he destination register of a load instruction (memory register) is also used by the following instruction.
section 2 cpu rev. 4.00 sep. 14, 2005 page 81 of 982 rej09b0023-0400 2.6 dsp extended-function instructions 2.6.1 introduction the newly added instructions are classi fied into the foll owing three groups: 1. additional system control instructions for the cpu unit 2. dsp unit memory-register sing le and double data transfer 3. dsp unit parallel processing group 1 instructions are provided to support loop control and data transfer between cpu core registers or memory and new control registers added to the cpu core. dsp operations employ a multi-level nested-loop structure. with a single-level loop, use of the decrement and test, dtrn, and conditional delayed branch bf/s instructions supported by the sh-3 is adequate. however, with nested loops, dsp performan ce can be improved by means of a zero-overhead loop control function. the rs, re, and mod registers have been added to support loop control and modulo addressing functions. instructions are supported for data tr ansfer between these ne w control registers and general registers or memory. in addition, the ld rs and ldre address cal culation registers have been added to reduce the code size for the initial settings for zero-overhead loop control. an independent control register, dsr, is provided for the dsp engine. this register is treated as a system register such as macl and mach. the a0, x0, x1, y0, an d y1 registers are treated as system registers from the cpu side, and lds/ sts instructions are su pported for the same purpose. table 2.25 shows the instruction code map for the new system control instructions for the cpu core. group 2 instructions are provided to reduce dsp operation program code size. data transfer instructions that perform no data processing are frequently executed by the dsp engine. in this case, a 32-bit instructio n code is unnecessarily long, and wastes space in the program memory area. all instructions in this class have a 16-bit code length, the same as conventional sh core instructions. single data transfer instructions have greater flexibility in term s of operands than the double data transfer instruction or parallel instruction class. group 3 instructions are provided for fast execution of digital signal processing operations using the dsp unit. these instructions have a 32-bit instruction code, so that a maximum of four instructions?an alu operation, multiplication, an d two data transfer instructions?can be executed in parallel.
section 2 cpu rev. 4.00 sep. 14, 2005 page 82 of 982 rej09b0023-0400 2.6.2 added cpu system control instructions the new instructions in this class are treated as part of the cpu core functions, and therefore all the added instructions have a 16-bit code length. all the additional instructions belong to the system control instruction group. table 2.25 summarizes the added sy stem instructions. new control registers?rs, re, and mod?have been added to the cpu core to support loop control and modulo addressing functions, and ldc and sts type instructions have been provided for these registers. the dsp engine's dsr, a0, x0, x1, y0, and y1 regi sters are treated as system registers such as mach and macl, and therefore sts and lds instructions are supported for these registers. as digital signal processing operations usually employ a multi-level nested-loop structure, dsp performance can be improved by means of a zero-overhead loop control function. setrc type instructions are provided to set the repeat count in the rc field in sr[27:16]. when an immediate operand type setrc instruction is executed, the 8- bit immediate operand data is set in sr[23:16], and 0 is set in the remaining bits, sr[27:24]. when a register operand type setrc instruction is executed, rn[11:0] is set in sr[2 7:16]. the start address and end ad dress of the repeat loop are set in the rs register and re register. there are two ways of setting the addresses: by using an ldc type instruction, or by using the ldrs and ldre instructions. table 2.25 added cpu system control instructions instruction instruction code operation execution states t bit setrc #imm 10000010iiiiiiii imm  rc (of sr) 1  setrc rn 0100nnnn00010100 rn[11:0]  r c (of sr) 1  ldrs @(disp,pc) 10001100dddddddd (disp 2 + pc)  rs 1  ldre @(disp,pc) 10001110dddddddd (disp 2 + pc)  re 1  stc mod,rn 0000nnnn01010010 mod  rn 1  stc rs,rn 0000nnnn01100010 rs  rn 1  stc re,rn 0000nnnn01110010 re  rn 1  sts dsr,rn 0000nnnn01101010 dsr  rn 1  sts a0,rn 0000nnnn01111010 a0  rn 1  sts x0,rn 0000nnnn10001010 x0  rn 1  sts x1,rn 0000nnnn10011010 x1  rn 1  sts y0,rn 0000nnnn10101010 y0  rn 1  sts y1,rn 0000nnnn10111010 y1  rn 1 
section 2 cpu rev. 4.00 sep. 14, 2005 page 83 of 982 rej09b0023-0400 instruction instruction code operation execution states t bit sts.l dsr,@-rn 0100nnnn01100010 rn ? 4 rn, dsr (rn) 1 ? sts.l a0,@-rn 0100nnnn01110010 rn ? 4 rn, a0 (rn) 1 ? sts.l x0,@-rn 0100nnnn10000010 rn ? 4 rn, x0 (rn) 1 ? sts.l x1,@-rn 0100nnnn10010010 rn ? 4 rn, x1 (rn) 1 ? sts.l y0,@-rn 0100nnnn10100010 rn ? 4 rn, y0 (rn) 1 ? sts.l y1,@-rn 0100nnnn10110010 rn ? 4 rn, y1 (rn) 1 ? stc.l mod,@-rn 0100nnnn01010011 rn ? 4 rn, mod (rn) 1 ? stc.l rs,@-rn 0100nnnn01100011 rn ? 4 rn, rs (rn) 1 ? stc.l re,@-rn 0100nnnn01110011 rn ? 4 rn, re (rn) 1 ? lds.l @rn+,dsr 0100nnnn01100110 (rn) dsr, rn + 4 rn 1 ? lds.l @rn+,a0 0100nnnn01110110 (rn) a0, rn + 4 rn 1 ? lds.l @rn+,x0 0100nnnn10000110 (rn) x0, rn + 4 rn 1 ? lds.l @rn+,x1 0100nnnn10010110 (rn) x1, rn + 4 rn 1 ? lds.l @rn+,y0 0100nnnn10100110 (rn) y0, rn + 4 rn 1 ? lds.l @rn+,y1 0100nnnn10110110 (rn) y1, rn + 4 rn 1 ? ldc.l @rn+,mod 0100nnnn01010111 (rn) mod, rn + 4 rn 4 ? ldc.l @rn+,rs 0100nnnn01100111 (rn) rs, rn + 4 rn 4 ? ldc.l @rn+,re 0100nnnn01110111 (rn) re, rn + 4 rn 4 ? lds rn,dsr 0100nnnn01101010 rn dsr 1 ? lds rn,a0 0100nnnn01111010 rn a0 1 ? lds rn,x0 0100nnnn10001010 rn x0 1 ? lds rn,x1 0100nnnn10011010 rn x1 1 ? lds rn,y0 0100nnnn10101010 rn y0 1 ? lds rn,y1 0100nnnn10111010 rn y1 1 ? ldc rn,mod 0100nnnn01011110 rn mod 4 ? ldc rn,rs 0100nnnn01101110 rn rs 4 ? ldc rn,re 0100nnnn01111110 rn re 4 ?
section 2 cpu rev. 4.00 sep. 14, 2005 page 84 of 982 rej09b0023-0400 2.6.3 single and double data tran sfer for dsp data instructions the new instructions in this class are prov ided to reduce the program code size for dsp operations. all the new instructions in this class have a 16-bit code length. instructions in this class are divided into two groups: single data transfer instruct ions and double data transfer instructions. the double data-transfer instructions provide the same flexibility in operand specification as is provided by the a fields of the data-transfer instruction fields of parallel-processi ng instructions. this is described in section 2.4.4, dsp instruction formats. conditional load instructions cannot be used with these 16-bit instructions. in singl e transfer, the ax pointer and tw o other pointers are used as the as pointer, but the ay pointer is not used. tables 2.26 and 2.27 list the single and double data transfer instructions. with double data tran sfer group instru ctions, x memory and y me mory can be accessed in parallel. the ax pointer can only be used by x memory access instructions, and the ay pointer only by y memory access instructions. double da ta transfer instructions can only access the on- chip x and y memory areas. single data transfer instructions use a 16-bit instruction code, and can access any memory address space. rn (n = 2 to 7) registers are normally used as the ax, ay, and as pointers. the pointer names themselves can be changed with the assembler rename function. the following renaming scheme is recommended. r2:as2, r3:as3, r4:ax0 (as0), r5:ax1 (as1), r6:ay0, r7:ay1, r8:ix, r9:iy
section 2 cpu rev. 4.00 sep. 14, 2005 page 85 of 982 rej09b0023-0400 table 2.26 double data transfer instructions instruction instruction code operation execu- tion states dc nopx 1111000*0*0*00** x memory no access 1  x memory data transfer movx.w @ax,dx 111100a *d*0*01** (ax)  msw of dx, 0  lsw of dx 1  movx.w @ax+,dx 111100a *d*0*10** (ax)  msw of dx, 0  lsw of dx, ax + 2  ax 1  movx.w @ax+ix,dx 111100a *d*0*11** (ax)  msw of dx, 0  lsw of dx, ax + ix  ax 1  movx.w da,@ax 111100a *d*1*01** msw of da  (ax) 1  movx.w da,@ax+ 111100a *d*1*10** msw of da  (ax), ax + 2  ax 1  movx.w da,@ax+ix 111100a *d*1*11** msw of da  (ax), ax + ix  ax 1  nopy 111100*0*0*0**00 y memory no access 1  y memory data transfer movy.w @ay,dy 111100 *a*d*0**01 (ay)  msw of dy, 0  lsw of dy 1  movy.w @ay+,dy 111100 *a*d*0**10 (ay)  msw of dy, 0  lsw of dy, ay + 2  ay 1  movy.w @ay+iy,dy 111100 *a*d*0**11 (ay)  msw of dy, 0  lsw of dy, ay + iy  ay 1  movy.w da,@ay 111100 *a*d*1**01 msw of da  (ay) 1  movy.w da,@ay+ 111100 *a*d*1**10 msw of da  (ay), ay + 2  ay 1  movy.w da,@ay+iy 111100 *a*d*1**11 msw of da  (ay), ay + iy  ay 1 
section 2 cpu rev. 4.00 sep. 14, 2005 page 86 of 982 rej09b0023-0400 table 2.27 single data transfer instructions instruction instruction code operation execution states dc movs.w @-as,ds 111101aadddd0000 as ? 2 as, (as) msw of ds, 0 lsw of ds 1 ? movs.w @as,ds 111101aadddd0100 (as) msw of ds, 0 lsw of ds 1 ? movs.w @as+,ds 111101aadddd1000 (as) msw of ds, 0 lsw of ds, as + 2 as 1 ? movs.w @as+is,ds 111101aadddd1100 (asc) msw of ds, 0 lsw of ds, as + is as 1 ? movs.w ds,@-as* 111101aadddd0001 as ? 2 as, msw of ds (as) 1 ? movs.w ds,@as* 111101aadddd0101 msw of ds (as) 1 ? movs.w ds,@as+* 111101aadddd1001 msw of ds (as), as + 2 as 1 ? movs.w ds,@as+is* 111101aadddd1101 msw of ds (as), as + is as 1 ? movs.l @-as,ds 111101aadddd0010 as ? 4 as, (as) ds 1 ? movs.l @as,ds 111101aadddd0110 (as) ds 1 ? movs.l @as+,ds 111101aadddd1010 (as) ds, as + 4 as 1 ? movs.l @as+is,ds 111101aadddd1110 (as) ds, as + is as 1 ? movs.l ds,@-as 111101aadddd0011 as ? 4 as, ds (as) 1 ? movs.l ds,@as 111101aadddd0111 ds (as) 1 ? movs.l ds,@as+ 111101aadddd1011 ds (as), as + 4 as 1 ? movs.l ds,@as+is 111101aadddd1111 ds (as), as + is as 1 ? note: * if guard bit registers a0g and a1g are specified in source operand ds, the data is output to the ldb[7:0] bus and the sign bit is copied into the upper bits, [31:8].
section 2 cpu rev. 4.00 sep. 14, 2005 page 87 of 982 rej09b0023-0400 the correspondence between dsp da ta transfer operands and registers is shown in table 2.28. cpu core registers are used as a pointer address that indicates a memory address. table 2.28 correspondence between dsp data transf er operands and registers register ax ix dx ay iy dy da as ds r0 ? ? ? ? ? ? ? ? ? cpu registers r1 ? ? ? ? ? ? ? ? ? r2 (as2) ? ? ? ? ? ? ? yes ? r3 (as3) ? ? ? ? ? ? ? yes ? r4 (ax0) yes ? ? ? ? ? ? yes ? r5 (ax1) yes ? ? ? ? ? ? yes ? r6 (ay0) ? ? ? yes ? ? ? ? ? r7 (ay1) ? ? ? yes ? ? ? ? ? r8 (ix) ? yes ? ? ? ? ? ? ? r9 (iy) ? ? ? ? yes ? ? ? ? a0 ? ? ? ? ? ? yes ? yes dsp registers a1 ? ? ? ? ? ? yes ? yes m0 ? ? ? ? ? ? ? ? yes m1 ? ? ? ? ? ? ? ? yes x0 ? ? yes ? ? ? ? ? yes x1 ? ? yes ? ? ? ? ? yes y0 ? ? ? ? ? yes ? ? yes y1 ? ? ? ? ? yes ? ? yes a0g ? ? ? ? ? ? ? ? yes a1g ? ? ? ? ? ? ? ? yes
section 2 cpu rev. 4.00 sep. 14, 2005 page 88 of 982 rej09b0023-0400 2.6.4 dsp operation instruction set dsp operation instructions are instructions for digital signal processing performed by the dsp unit. these instructions have a 32-bit instruction code, and multiple instructions can be executed in parallel. the instruction code is divided into an a field and b field; a parallel data transfer instruction is specified in the a field, and a single or double data operation instruction in the b field. instructions can be specified independently, and are also executed independently. the parallel data transfer instruction specified in th e a field is exactly the same as a double data transfer instruction. the function of the a field? that is, the data transf er instruction field?is basically the same as in the double data transfer instructions described in section 2.6.3, single and double data transfer for dsp data instructions, but has a special function in load instructions. b-field data operation instructions are of three kinds: double data operation instructions, conditional single data operation instructions, and unconditional single data operation instructions. the formats of the dsp operation instructions are shown in table 2.29 . the respective operands are selected independently from the dsp regist ers. the correspondence between dsp operation instruction operands and registers is shown in table 2.30. table 2.29 dsp operation instruction formats type instruction formats double data operation instructions aluop. sx, sy, du mltop. se, df, dg conditional single data operation instructions aluop. sx, sy, dz dct aluop. sx, sy, dz dcf aluop. sx, sy, dz aluop. sx, dz dct aluop. sx, dz dcf aluop. sx, dz aluop. sy, dz dct aluop. sy, dz dcf aluop. sy, dz unconditional single data operation instructions aluop. sx, sy, dz aluop. sx, dz aluop. sy, dz mltop. se, sf, dg
section 2 cpu rev. 4.00 sep. 14, 2005 page 89 of 982 rej09b0023-0400 table 2.30 correspondence between dsp instruction operands and registers alu/bpu operations multiply operations register sx sy dz du se sf dg a0 yes ? yes yes ? ? yes a1 yes ? yes yes yes yes yes m0 ? yes yes ? ? ? yes m1 ? yes yes ? ? ? yes x0 yes ? yes yes yes yes ? x1 yes ? yes ? yes ? ? y0 ? yes yes yes yes yes ? y1 ? yes yes ? ? yes ? when writing parallel instructions, the b-field instruction is written first, followed by the a-field instruction. a sample parallel processing program is shown in figure 2.16. dcf padd a0, m0, a0 pmuls x0, y0, m0 movx.w @r4+, x0 movy.w @r6+, y0 [;] pinc x1, a1 movx.w a0, @r5+r8 movy.w @r7+, y0 [;] pcmp x1, m0 movx.w @r4 [nopy] [;] figure 2.16 sample parallel instruction program square brackets mean that the contents can be omitted. the no operation instructions nopx and nopy can be omitted. table 2.31 gives an overview of the b field in parallel operation instructions. a semicolon is the instruction line delimiter, but this can also be omitted. if the semicolon delimiter is used, the area to the right of the semi colon can be used as a comment field. this has the same function as with conventional sh tools. the dsr register condition code bit (dc) is always updated on the basis of the result of an unconditional alu or shift operation instruction. conditional instructions do not update the dc bit. multiply instructions, also, do not update the dc bit. dc bit updating is performed by means of bits cs0 to cs2 in the dsr register. the dc bit update rules are shown in table 2.32.
section 2 cpu rev. 4.00 sep. 14, 2005 page 90 of 982 rej09b0023-0400 table 2.31 dsp operation instructions instruction instruction code operation execution states dc pmuls se,sf,dg 111110 ********** 0100eeff0000gg00 se * sf  dg (signed) 1  padd sx,sy,du pmuls se,sf,dg 111110********** 0111eeffxxyygguu sx + sy  du se * sf  dg (signed) 1 * psub sx,sy,du pmuls se,sf,dg 111110********** 0110eeffxxyygguu sy ? sy  du se * sf  dg (signed) 1 * padd sx,sy,dz 111110 ********** 10110001xxyyzzzz sx + sy  dz 1 * dct padd sx,sy,dz 111110 ********** 10110010xxyyzzzz if dc = 1, sx + sy  dz if dc = 0, nop 1  dcf padd sx,sy,dz 111110 ********** 10110011xxyyzzzz if dc = 0, sx + sy  dz if dc = 1, nop 1  psub sx,sy,dz 111110 ********** 10100001xxyyzzzz sx ? sy  dz 1 * dct psub sx,sy,dz 111110 ********** 10100010xxyyzzzz if dc = 1, sx ? sy  dz if dc = 0, nop 1  dcf psub sx,sy,dz 111110 ********** 10100011xxyyzzzz if dc = 0, sx ? sy  dz if dc = 1, nop 1  psha sx,sy,dz 111110 ********** 10010001xxyyzzzz if sy > = 0, sx << sy  dz (arithmetic shift) if sy<0, sx>>sy  dz 1 * dct psha sx,sy,dz 111110 ********** 10010010xxyyzzzz if dc = 1 & sy > = 0, sx << sy  dz (arithmetic shift) if dc = 1 & sy < 0, sx >> sy  dz if dc = 0, nop 1 
section 2 cpu rev. 4.00 sep. 14, 2005 page 91 of 982 rej09b0023-0400 instruction instruction code operation execution states dc dcf psha sx,sy,dz 111110 ********** 10010011xxyyzzzz if dc = 0 & sy > = 0, sx << sy dz (arithmetic shift) if dc = 0 & sy < 0, sx >> sy dz if dc = 1, nop 1 ? pshl sx,sy,dz 111110 ********** 10000001xxyyzzzz if sy > = 0, sx << sy dz (logical shift) if sy < 0, sx >> sy dz 1 * dct pshl sx,sy,dz 111110 ********** 10000010xxyyzzzz if dc = 1 & sy > = 0, sx << sy dz (logical shift) if dc = 1 & sy < 0, sx >> sy dz if dc = 0, nop 1 ? dcf pshl sx,sy,dz 111110 ********** 10000011xxyyzzzz if dc = 0 & sy > = 0, sx << sy dz (logical shift) if dc = 0 & sy < 0, sx >> sy dz if dc = 1, nop 1 ? pcopy sx,dz 111110 ********** 11011001xx00zzzz sx dz 1 * pcopy sy,dz 111110 ********** 1111100100yyzzzz sy dz 1 * dct pcopy sx,dz 111110 ********** 11011010xx00zzzz if dc = 1, sx dz if dc = 0, nop 1 ? dct pcopy sy,dz 111110 ********** 1111101000yyzzzz if dc = 1, sy dz if dc = 0, nop 1 ? dcf pcopy sx,dz 111110 ********** 11011011xx00zzzz if dc = 0, sx dz if dc = 1, nop 1 ? dcf pcopy sy,dz 111110 ********** 1111101100yyzzzz if dc = 0, sy dz if dc = 1, nop 1 ?
section 2 cpu rev. 4.00 sep. 14, 2005 page 92 of 982 rej09b0023-0400 instruction instruction code operation execution states dc pdmsb sx,dz 111110 ********** 10011101xx00zzzz sx dz normalization count shift value 1 * pdmsb sy,dz 111110 ********** 1011110100yyzzzz sx dz normalization count shift value 1 * dct pdmsb sx,dz 111110 ********** 10011110xx00zzzz if dc = 1, normalization count shift value sx dz if dc = 0, nop 1 ? dct pdmsb sy,dz 111110 ********** 1011111000yyzzzz if dc = 1, normalization count shift value sy dz if dc = 0, nop 1 ? dcf pdmsb sx,dz 111110 ********** 10011111xx00zzzz if dc = 0, normalization count shift value sx dz if dc = 1, nop 1 ? dcf pdmsb sy,dz 111110 ********** 1011111100yyzzzz if dc = 0, normalization count shift value sy dz if dc = 1, nop 1 ? pinc sx,dz 111110 ********** 10011001xx00zzzz msw of sx dz 1 * pinc sy,dz 111110 ********** 1011100100yyzzzz msw of sy dz 1 * dct pinc sx,dz 111110 ********** 10011010xx00zzzz if dc = 1, msw of sx + 1 dz if dc = 0, nop 1 ? dct pinc sy,dz 111110 ********** 1011101000yyzzzz if dc = 1, msw of sy + 1 dz if dc = 0, nop 1 ? dcf pinc sx,dz 111110 ********** 10011011xx00zzzz if dc = 0, msw of sx + 1 dz if dc = 1, nop 1 ? dcf pinc sy,dz 111110 ********** 1011101100yyzzzz if dc = 0, msw of sy + 1 dz if dc = 1, nop 1 ? pneg sx,dz 111110 ********** 11001001xx00zzzz 0 ? sx dz 1 *
section 2 cpu rev. 4.00 sep. 14, 2005 page 93 of 982 rej09b0023-0400 instruction instruction code operation execution states dc pneg sy,dz 111110 ********** 1110100100yyzzzz 0 ? sy dz 1 * dct pneg sx,dz 111110 ********** 11001010xx00zzzz if dc = 1, 0 ? sx dz if dc = 0, nop 1 ? dct pneg sy,dz 111110 ********** 1110101000yyzzzz if dc = 1, 0 ? sy dz if dc = 0, nop 1 ? dcf pneg sx,dz 111110 ********** 11001011xx00zzzz if dc = 0, 0 ? sx dz if dc = 1, nop 1 ? dcf pneg sy,dz 111110 ********** 1110101100yyzzzz if dc = 0, 0 ? sy dz if dc = 1, nop 1 ? por sx,sy,dz 111110 ********** 10110101xxyyzzzz sx | sy dz 1 * dct por sx,sy,dz 111110 ********** 10110110xxyyzzzz if dc = 1, sx | sy dz if dc = 0, nop 1 ? dcf por sx,sy,dz 111110 ********** 10110111xxyyzzzz if dc = 0, sx | sy dz if dc = 1, nop 1 ? pand sx,sy,dz 111110 ********** 10010101xxyyzzzz sx & sy dz 1 * dct pand sx,sy,dz 111110 ********** 10010110xxyyzzzz if dc = 1, sx & sy dz if dc = 0, nop 1 ? dcf pand sx,sy,dz 111110 ********** 10010111xxyyzzzz if dc = 0, sx & sy dz if dc = 1, nop 1 ? pxor sx,sy,dz 111110 ********** 10100101xxyyzzzz sx ^ sy dz 1 * dct pxor sx,sy,dz 111110 ********** 10100110xxyyzzzz if dc = 1, sx ^ sy dz if dc = 0, nop 1 ? dcf pxor sx,sy,dz 111110 ********** 10100111xxyyzzzz if dc = 1, sx ^ sy dz if dc = 0, nop 1 ? pdec sx,dz 111110 ********** 10001001xx00zzzz sx [39:16] ? 1 dz 1 *
section 2 cpu rev. 4.00 sep. 14, 2005 page 94 of 982 rej09b0023-0400 instruction instruction code operation execution states dc pdec sy,dz 111110 ********** 1010100100yyzzzz sy [31:16] ? 1 dz 1 * dct pdec sx,dz 111110 ********** 10001010xx00zzzz if dc = 1, sx [39:16] ? 1 dz if dc = 0, nop 1 ? dct pdec sy,dz 111110 ********** 1010101000yyzzzz if dc = 1, sy [31:16] ? 1 dz if dc = 0, nop 1 ? dcf pdec sx,dz 111110 ********** 10001011xx00zzzz if dc = 0, sx [39:16] ? 1 dz if dc = 1, nop 1 ? dcf pdec sy,dz 111110 ********** 1010101100yyzzzz if dc = 0, sy [31:16] ? 1 dz if dc = 1, nop 1 ? pclr dz 111110 ********** 100011010000zzzz h'00000000 dz 1 * dct pclr dz 111110 ********** 100011100000zzzz if dc = 1, h'00000000 dz if dc = 0, nop 1 ? dcf pclr dz 111110 ********** 100011110000zzzz if dc = 0, h'00000000 dz if dc = 1, nop 1 ? psha #imm,dz 111110 ********** 00010iiiiiiizzzz if imm > = 0, dz << imm dz (arithmetic shift) if imm<0, dz>>imm dz 1 * pshl #imm,dz 111110 ********** 00000iiiiiiizzzz if imm > = 0, dz << imm dz (logical shift) if imm < 0, dz >> imm dz 1 * psts mach,dz 111110 ********** 110011010000zzzz mach dz 1 ? dct psts mach,dz 111110 ********** 110011100000zzzz if dc = 1, mach dz 1 ? dcf psts mach,dz 111110 ********** 110011110000zzzz if dc = 0, mach dz 1 ? psts macl,dz 111110 ********** 110111010000zzzz macl dz 1 ?
section 2 cpu rev. 4.00 sep. 14, 2005 page 95 of 982 rej09b0023-0400 instruction instruction code operation execution states dc dct psts macl,dz 111110 ********** 110111100000zzzz if dc = 1, macl dz 1 ? dcf psts macl,dz 111110 ********** 110111110000zzzz if dc = 0, macl dz 1 ? plds dz,mach 111110 ********** 111011010000zzzz dz mach 1 ? dct plds dz,mach 111110 ********** 111011100000zzzz if dc = 1, dz mach 1 ? dcf plds dz,mach 111110 ********** 111011110000zzzz if dc = 0, dz mach 1 ? plds dz,macl 111110 ********** 111111010000zzzz dz macl 1 ? dct plds dz,macl 111110 ********** 111111100000zzzz if dc = 1, dz macl 1 ? dcf plds dz,macl 111110 ********** 111111110000zzzz if dc = 0, dz macl 1 ? paddc sx,sy,dz 111110 ********** 10110000xxyyzzzz sx + sy + dc dz carry dc 1 carry psubc sx,sy,dz 111110 ********** 10100000xxyyzzzz sx ? sy ? dc dz borrow dc 1 borrow pcmp sx,sy 111110 ********** 10000100xxyy0000 sx ? sy dc update * 1 * pabs sx,dz 111110 ********** 10001000xx00zzzz if sx < 0, 0 ? sx dz if sx > = 0, nop 1 * pabs sy,dz 111110 ********** 1010100000yyzzzz if sy < 0, 0 ? sy dz if sx > = 0, nop 1 * prnd sx,dz 111110 ********** 10011000xx00zzzz sx + h'00008000 dz lsw of dz h'0000 1 * prnd sy,dz 111110 ********** 1011100000yyzzzz sy + h'00008000 dz lsw of dz h'0000 1 * note: * see table 2.32.
section 2 cpu rev. 4.00 sep. 14, 2005 page 96 of 982 rej09b0023-0400 table 2.32 dc bit update definitions cs [2:0] condition mode description 0 0 0 carry or borrow mode the dc bit is set if an alu arithm etic operation generates a carry or borrow, and is cleared otherwise. when a psha or pshl shift instruction is executed, the last bit data shifted out is copied into the dc bit. when an alu logical operation is executed, the dc bit is always cleared. 0 0 1 negative value mode when an alu or shift (psha) arit hmetic operation is executed, the msb of the result, including the guard bits, is copied into the dc bit. when an alu or shift (pshl) logical operation is executed, the msb of the result, excluding the guard bits, is copied into the dc bit. 0 1 0 zero value mode the dc bit is set if t he result of an alu or shift operation is all- zeros, and is cleared otherwise. 0 1 1 overflow mode the dc bit is set if the re sult of an alu or shift (psha) arithmetic operation exceeds the destination register range, excluding the guard bits, and is cleared otherwise. when an alu or shift (pshl) logical operation is executed, the dc bit is always cleared. 1 0 0 signed greater-than mode this mode is similar to signed greater-or-equal mode, but dc is cleared if the result is all-zeros. dc = ~{(negative value ^ over-range) | zero value}; in case of arithmetic operation dc = 0; in case of logical operation 1 0 1 signed greater-or- equal mode if the result of an alu or shi ft (psha) arithmetic operation exceeds the destination register range, including the guard bits ("over-range"), the definition is the same as in negative value mode. if the result is not over-rang e, the definition is the opposite of that in negative value mode. when an alu or shift (pshl) logical operation is executed, the dc bit is always cleared. dc = ~(negative value ^ over-range); in case of arithmetic operation dc = 0 ; in case of logical operation 1 1 0 reserved 1 1 1 reserved
section 2 cpu rev. 4.00 sep. 14, 2005 page 97 of 982 rej09b0023-0400 conditional operations and data transfer: some instructions belonging to this class can be executed conditionally, as described earlier. the specified condition is valid only for the b field of the instruction, and is not valid for data transfer instructions for which a parallel specification is made. examples are shown in figure 2.17. dct padd x0,y0,a0 movx.w @r4+,x0 movy.w a0,@r6+r9 ; when condition is true before execution: after execution: x0=h'33333333, y0=h'55555555, a0=h'123456789a, r4=h'00008000, r6=h'00008233, r9=h'00000004 (r4)=h'1111, (r6)=h'2222 x0=h'11110000, y0=h'55555555, a0=h'0088888888, r4=h'00008002, r6=h'00008237, r9=h'00000004 (r4)=h'1111, (r6)=h'3456 when condition is false before execution: after execution: x0=h'33333333, y0=h'55555555, a0=h'123456789a, r4=h'00008000, r6=h'00008233, r9=h'00000004 (r4)=h'1111, (r6)=h'2222 x0=h'11110000, y0=h'55555555, a0=h'123456789a, r4=h'00008002, r6=h'00008237, r9=h'00000004 (r4)=h'1111, (r6)=h'3456 figure 2.17 examples of conditional operations and data transfer instructions
section 2 cpu rev. 4.00 sep. 14, 2005 page 98 of 982 rej09b0023-0400 assignment of nopx and nopy instruction codes: when there is no data transfer instruction to be parallel-processed simultaneously with a dsp operation instruction, an nopx or nopy instruction can be written as the data transfer in struction, or the instruction can be omitted. the instruction code is the same whether an nopx or nopy instruction is written or the instruction is omitted. examples of nopx and nopy instruction codes are shown in table 2.33. table 2.33 examples of nopx and nopy instruction codes instruction code padd x0,y0,a0 movx.w @r4+,x0 movy.w @r6+r9,y0 1111100000001011 1011000100000111 padd x0,y0,a0 nopx movy.w @r6+r9,y0 1111100000000011 1011000100000111 padd x0,y0,a0 nopx nopy 1111100000000000 1011000100000111 padd x0,y0,a0 nopx 1111100000000000 1011000100000111 padd x0,y0,a0 1111100000000000 1011000100000111 movx.w @r4+,x0 movy.w @r6+r9,y0 1111000000001011 movx.w @r4+,x0 nopy 1111000000001000 movs.w @r4+,x0 1111010010001000 nopx movy.w @r6+r9,y0 1111000000000011 movy.w @r6+r9,y0 1111000000000011 nopx nopy 1111000000000000 nop 0000000000001001
section 3 dsp operation rev. 4.00 sep. 14, 2005 page 99 of 982 rej09b0023-0400 section 3 dsp operation 3.1 data operations of dsp unit 3.1.1 alu fixed-point operations figure 3.1 shows the alu arithmetic operation flow. table 3.1 shows the variation of this type of operation and table 3.2 shows the correspondence between each operand and registers. 39 31 0 source 1 0 destination alu dsr gt z n v dc 0 source 2 guard 39 31 guard guard 39 31 figure 3.1 alu fixed-point arithmetic operation flow note: the alu fixed-point arithmetic operations are basically 40-bit operation; 32 bits of the base precision and 8 bits of the guard-bit parts. so the signed bit is copied to the guard-bit parts when a register not providing the guard-bit parts is specified as the source operand. when a register not providing the guard-bit part s is specified as a de stination operand, the lower 32 bits of the operation result are input into the destination register. alu fixed-point operations are executed betw een registers. each source and destination operand are selected independently from on e of the dsp register s. when a register providing guard bits is specified as an operand, the guard bits are activated for this type of operation. these operations are executed in th e dsp stage, as shown in figure 3.2. the dsp stage is the same stage as the ma st age in which memory access is performed.
section 3 dsp operation rev. 4.00 sep. 14, 2005 page 100 of 982 rej09b0023-0400 table 3.1 variation of alu fixed-point operations mnemonic function source 1 source 2 destination padd addition sx sy dz (du) psub subtraction sx sy dz (du) paddc addition with carry sx sy dz psubc subtraction with borrow sx sy dz pcmp comparison sx sy ? pcopy data copy sx all 0 dz all 0 sy dz pabs absolute sx all 0 dz all 0 sy dz pneg negation sx all 0 dz all 0 sy dz pclr clear all 0 all 0 dz table 3.2 correspondence betw een operands and registers register sx sy dz du a0 yes ? yes yes a1 yes ? yes yes m0 ? yes yes ? m1 ? yes yes ? x0 yes ? yes yes x1 yes ? yes ? y0 ? yes yes yes y1 ? yes yes ? as shown in figure 3.2, data loaded from the memory at the ma stage, which is programmed at the same line as the alu operation, is not used as a source operand for this operation, even though the destination operand of the data load operation is identical to the source operand of the alu operation. in this case, previous operation results are used as the source operands for the alu operation, and then updated as the destination operand of the data load operation.
section 3 dsp operation rev. 4.00 sep. 14, 2005 page 101 of 982 rej09b0023-0400 if 12 movx movx movx movx & padd movx & padd movx & padd 3456 id ex ma/dsp padd x0, y0, a0 movx.w @(r4, r8), x0 movx.w @r4+, x0 slot stage operation sequence example addressing addressing previous cycle result is used. figure 3.2 operation sequence example every time an alu arithmetic operation is execute d, the dc, n, z, v, and gt bits in dsr are basically updated in accordance with the operation result. however, in case of a conditional operation, they are not updated ev en though the specified condition is true and the operation is executed. in case of an unconditional operation, they are always updated in accordance with the operation result. the definition of a dc bit is select ed by cs0 to cs2 (condition selection) bits in dsr. the dc bit result is as follows: carry or borrow mode: cs[2:0] = 000: the dc bit indicates that car ry or borrow is generated from the most significant bit of the operation resu lt, except the guard-bit parts. some examples are shown in figure 3.3. this mode is the default condition. when the input data is negative in a pabs or pneg instruction, carry is generated to add 1 to the lsb. example 1 carry detecting point guard bits carry is detected 0000 0000 +) 0000 0000 1111 0000 1111 0000 1111 0000 1111 0001 0000 0001 0000 0000 0000 0000 example 2 carry detecting point guard bits carry is not detected 1111 0011 +) 1111 1111 0111 0001 0000 0000 0000 0000 0000 0000 0011 (1) 1110 1000 0000 0000 0000 example 3 borrow detecting point guard bits borrow is not detected 0000 0000 ?) 0000 0000 0000 0000 0000 0000 0000 0000 0001 0001 0000 0000 0000 0000 0000 0000 example 4 borrow detecting point guard bits borrow is detected 0000 0000 ?) 0000 0000 0001 0001 0000 0000 0000 0000 0001 0010 1111 1111 1111 1111 1111 1111 figure 3.3 dc bit generation examples in carry or borrow mode
section 3 dsp operation rev. 4.00 sep. 14, 2005 page 102 of 982 rej09b0023-0400 negative value mode: cs[2:0] = 001: the dc flag indicates the same state as the msb of the operation result. when the result is a negative number, the dc bit shows 1. when it is a positive number, the dc bit shows 0. the alu always executes 40-bit arithmetic operation, so the sign bit to detect whether positive or negative is alwa ys got from the msb of the operation result regardless of the destination operand. some examples are shown in figure 3.4. example 1 sign bit guard bits negative value 1100 0000 +) 0000 0000 0000 0000 0000 0000 0000 0000 0000 0001 1100 0000 0000 0000 0000 0001 example 2 sign bit guard bits positive value 0011 0000 +) 0000 0000 0000 1000 0000 0000 0000 0000 0000 0001 0011 0000 1000 0000 0000 0001 figure 3.4 dc bit generation examples in negative value mode zero value mode: cs[2:0] = 010: the dc flag indicates whether the operation result is 0 or not. when the result is 0, the dc bit shows 1. when it is not 0, the dc bit shows 0. overflow mode: cs[2:0] = 011: the dc bit indicates whether or not overflow occurs in the result. when an operation yields a result beyond the range of the destination register, except the guard-bit parts, the dc bit is set. even though guard bits are provided, the dc bit always indicates the result of when no guard bits are provided. so, the dc bit is always set if the guard-bit parts are used for large number representation. some dc bit generation examples in overflow mode are shown in figure 3.5. example 1 overflow detecting field guard bits overflow case 1111 1111 +) 1111 1111 1111 1000 1111 0000 1111 0000 1111 0000 1111 1111 0111 1111 1111 1111 example 2 overflow detecting field guard bits non overflow case 1111 1111 +) 1111 1111 1111 1000 1111 0000 1111 0000 1111 0001 1111 1111 1000 0000 0000 0000 figure 3.5 dc bit generation examples in overflow mode
section 3 dsp operation rev. 4.00 sep. 14, 2005 page 103 of 982 rej09b0023-0400 signed greater than mode: cs[2:0] = 100: the dc bit indicates whether or not the source 1 data (signed) is greater than the source 2 data (signed) as the result of compare operation pcmp. so, a pcmp operation should be executed in adva nce when a conditional operation is executed under this condition mode. this mode is similar to the negative value mode described before, because the result of a comp are operation is usually a positive va lue if the source 1 data is greater than the source 2 data. however, the signed bit of the result shows a negative value if the compare operation yields a result beyond the range of the destination operand, including the guard-bit parts (called "over-range"), even though the source 1 data is greater than the source 2 data. the dc bit is updated concerning this type of special case in this condition mode. the equation below shows the definition of getting this condition: dc = ~ {(negative ^ over-range) | zero} when the pcmp operation is executed under this condition mode, the result of the dc bit is the same as the t bit's result of the cmp/gt operation of the sh core instruction. signed greater than or equal mode: cs[2:0] = 101: the dc bit indicates whether the source 1 data (signed) is greater than or equal to the source 2 data (signed) as the result of compare operation pcmp. so, a pcmp operation should be executed in advance when a conditional operation is executed under this condition mode. this mode is similar to the signed greater than mode described before but the equal case is also included in this mode. the equation below shows the definition of getting this condition: dc = ~ (negative ^ over-range) when the pcmp operation is executed under this condition mode, the result of the dc bit is the same as the t bit's result of a cmp/ge operation of the sh core instruction. the n bit always indicates the same state as the dc bit set in negative value mode by the cs[2:0] bits. see the negative value mode part above. the z bit always indicates th e same state as the dc bit set in zero value mode by the cs[2:0] bits. see the zero value mode part above. the v bit always indicates the same state as the dc bit se t in overflow mode by the cs[2:0] bits. see the overflow mode part above. the gt bit always indi cates the same state as the dc bit set in signed greater than mode by the cs[2:0] bits. see the signed greater than mode part above. note: the dc bit is always updated as the carry flag for "paddc" and is always updated as the borrow flag for "psubc" regardless of the cs[2:0] state. overflow protection: the s bit in sr is effective for any alu fixed-point arithmetic operations in the dsp unit. see section 3.1.8, overflow protection, for details.
section 3 dsp operation rev. 4.00 sep. 14, 2005 page 104 of 982 rej09b0023-0400 3.1.2 alu integer operations figure 3.6 shows the alu integer arithmetic operation flow. table 3.3 shows the variation of this type of operation. the correspondence between each operand and registers is the same as alu fixed-point operations as shown in table 3.2. 39 31 0 source 1 0 destination alu dsr gt z n v dc 0 source 2 ignored cleared guard 39 31 39 31 guard guard figure 3.6 alu integer arithmetic operation flow table 3.3 variation of alu integer operations mnemonic function source 1 source 2 destination pinc increment by 1 sx + 1 dz + 1 sy dz pdec decrement by 1 sx ? 1 dz ? 1 sy dz note: the alu integer operations are basically 24 -bit operation, the upper 16 bits of the base precision and 8 bits of the guard bits parts. so the signed bit is copied to the guard-bit parts when a register not providing the guard-bit pa rts is specified as the source operand. when a register not providing the guard-bit parts is specified as a destination operand, the upper word excluding the guard bits of the operation re sult are input into the destination register.
section 3 dsp operation rev. 4.00 sep. 14, 2005 page 105 of 982 rej09b0023-0400 in alu integer arithmetic operations, the lower wo rd of the source operand is ignored and the lower word of the destination operand is automatically cleared. the guard-bit parts are effective in integer arithmetic operations if they are supporte d. others are basically the same operation as alu fixed-point arithmetic operations. as shown in table 3.3, however, this type of operation provides two kinds of instructions only, so that the second operand is actually either +1 or ?1. when a word data is loaded into one of the dsp un it's registers, it is input as an upper word data. when a register providing guard bits is specified as an operand, the guard b its are also activated. these operations, as well as fixed-point operations , are executed in the dsp stage, as shown in figure 3.2. the dsp stage is the same stag e as the ma stage in which memory access is performed. every time an alu arithmetic operation is execute d, the dc, n, z, v, and gt bits in dsr are basically updated in accordance with the operatio n result. this is the same as fixed-point operations but the lower word of each source and destination operand is not used in order to generate them. see section 3.1.1, alu fixed-point operations, for details. in case of a conditional operation, they are not updated even though the specified condition is true and the operation is execu ted. in case of an unconditional oper ation, they are always updated in accordance with the operatio n result. see section 3.1.1, alu fi xed-point operations, for details. overflow protection: the s bit in sr is effective for any alu integer arithmetic operations in dsp unit. see section 3.1.8, overflow protection, for details. 3.1.3 alu logical operations figure 3.7 shows the alu logical operation flow. table 3.4 shows the variation of this type of operation. the correspondence be tween each operand and registers is the same as the alu fixed- point operations as shown in table 3.2. logical operations are also execu ted between registers. each source and destination operand are selected independently from one of the dsp registers. as shown in figure 3.7, this type of operation uses only the upper word of each operand. the lower word and guard-bit parts are ignored for the source operand and those of th e destination operand are automatically cleared. these operations are also executed in the dsp stag e, as shown in figure 3.2. the dsp stage is the same stage as the ma stage in which memory access is performed.
section 3 dsp operation rev. 4.00 sep. 14, 2005 page 106 of 982 rej09b0023-0400 39 31 0 soruce 1 0 destination alu dsr gt z n v dc 0 source 2 ignored cleared 39 31 39 31 guard guard guard figure 3.7 alu logical operation flow table 3.4 variation of alu logical operations mnemonic function source 1 source 2 destination pand logical and sx sy dz por logical or sx sy dz pxor logical exclusive or sx sy dz every time an alu logical operation is executed , the dc, n, z, v, and gt bits in the dsr register are basically updated in accordance with the operation re sult. in case of a conditional operation, they are not updated ev en though the specified condition is true and the operation is executed. in case of an unconditional operation, they are always updated in accordance with the operation result. the definition of the dc bit is selected by the cs0 to cs2 (condition selection) bits in dsr. the dc bit result is: 1. carry or borrow mode: cs[2:0] = 000 the dc bit is always cleared. 2. negative value mode: cs[2:0] = 001 bit 31 of the operation result is loaded into the dc bit. 3. zero value mode: cs[2:0] = 010 the dc bit is set when the operation result is zero; otherwise it is cleared. 4. overflow mode: cs[2:0] = 011 the dc bit is always cleared.
section 3 dsp operation rev. 4.00 sep. 14, 2005 page 107 of 982 rej09b0023-0400 5. signed greater than mode: cs[2:0] = 100 the dc bit is always cleared. 6. signed greater than or equal mode: cs[2:0] = 101 the dc bit is always cleared. the n bit always indicates the same state as the dc bit set in negative value mode by the cs[2:0] bits. see the negative value mode part above. the z bit always indicates th e same state as the dc bit set in zero value mode by the cs[2:0] bits. see the zero value mode part above. the v bit always indicates the same state as the dc bit se t in overflow mode by the cs[2:0] bits. see the overflow mode part above. the gt bit always indi cates the same state as the dc bit set in signed greater than mode by the cs[2:0] bits. see the signed greater than mode part above. 3.1.4 fixed-point multiply operation figure 3.8 shows the multiply operation flow. table 3.5 shows the variation of this type of operation and table 3.6 shows th e correspondence between each operand and registers. the multiply operation of the dsp unit is single-wor d signed single-precision multiplication. these operations are executed in the dsp st age, as shown in figure 3.2. the dsp stage is the same stage as the ma stage in which memory access is performed. if a double-precision multiply operation is need ed, the sh-3's standard double-word multiply instructions can be made of use. 0 source 1 s 10 mac ignored s0 0 source 2 s destination 0 39 31 guard guard 39 31 guard 39 31 figure 3.8 fixed-point multiply operation flow
section 3 dsp operation rev. 4.00 sep. 14, 2005 page 108 of 982 rej09b0023-0400 table 3.5 variation of fixed-point multiply operation mnemonic function source 1 source 2 destination pmuls signed multiplication se sf dg table 3.6 correspondence betw een operands and registers register se sf dg a0 ? ? yes a1 yes yes yes m0 ? ? yes m1 ? ? yes x0 yes yes ? x1 yes ? ? y0 yes yes ? y1 ? yes ? note: the multiply operations basically generat e 32-bit operation results. so when a register providing the guard-bit parts are specified as a destination operand, the guard-bit parts will copy bit 31 of the operation result. the multiply operation of the dsp unit side is not integer but fixed-point arithmetic. so, the upper words of each multiplier and multiplican d are input into a ma c unit as shown in figure 3.8. in the sh's standard multiply operations, the lower words of both source operands are input into a mac unit. the operation result is also di fferent from the sh's case. the sh 's multiply operation result is aligned to the lsb of the destination, but the fixed-point multiply operation result is aligned to the msb, so that the lsb of the fixed-point multiply operation result is always 0. this fixed-point multiply operation is executed in one cycle multiply operation is always unconditional, but does not affect any condition code bits, dc, n, z, v and gt, in dsr. overflow protection: the s bit in sr is effective for this multiply operation in the dsp unit. see section 3.1.8, overflow protection, for details. if the s bit is 0, overflow occurs only when h'8000* h'8000 ((-1.0)* (-1.0)) operation is executed as signed fixed-point multiply. the result is h'00 8000 0000 but it does not mean ( +1.0 ). if the s bit is 1, overflow is prevented and the result is h'00 7fff ffff .
section 3 dsp operation rev. 4.00 sep. 14, 2005 page 109 of 982 rej09b0023-0400 3.1.5 shift operations shift operations can use either register or immediate value as the shift amount operand. other source and destination operands are specified by the register. there are two kinds of shift operations. table 3.7 shows the variation of this type of operation. the correspondence between each operand and registers, except for immediate operands, is the same as the alu fixed-point operations as shown in table 3.2. table 3.7 variation of shift operations mnemonic function source 1 source 2 destination psha sx, sy, dz arithmetic shift sx sy dz pshl sx, sy, dz logical shift sx sy dz psha #imm1, dz arithmetic shift with immediate. dz imm1 dz pshl #imm2, dz logical shift with immediate. dz imm2 dz note: ?32 <= imm1 <= +32, ?16 <= imm2 <= +16 arithmetic shift: figure 3.9 shows the arithmetic shift operation flow. dsr gt z n v dc updated 7g 0g 31 16 15 0 sy 7g 0g 31 16 15 0 0 shift out shift out (msb copy) ignored left shift right shift 7g 0g 31 23 22 16 imm1 60 15 0 shift amount data: (source 2) > = 0 < 0 +32 to ?32 figure 3.9 arithmetic shift operation flow note: the arithmetic shift operations are basically 40-bit operation, that is , the 32 bits of the base precision and 8 bits of the guard-bit parts. so the signed bit is copied to the guard-bit parts when a register not providing the guard-bit parts is specified as the source operand. when a register not providing the guard-bit part s is specified as a de stination operand, the lower 32 bits of the operation result are input into the destination register.
section 3 dsp operation rev. 4.00 sep. 14, 2005 page 110 of 982 rej09b0023-0400 in this arithmetic shift operation, all bits of the source 1 and destination operands are activated. the shift amount is specified by the source 2 operand as an inte ger data. the source 2 operand can be specified by either a regist er or immediate operand. the available shift range is from ?32 to +32. here, a negative value means the right shift, and a positive value means the left shift. it is possible for any source 2 operand to specify from ?64 to +63 but the result is unknown if an invalid shift value is specified. in case of a shift with an immediate operan d instruction, the source 1 operand must be the same register as the destination's. this operation is executed in the dsp stage, as shown in figure 3.2 as well as in fixed-point operations . the dsp stage is the same stage as the ma stage in which memory access is performed. every time an arithmetic shift operation is execute d, the dc, n, z, v, and gt bits in dsr are basically updated in accordance with the operation result. in case of a conditional operation, they are not updated even though the specified condition is true and the operation is executed. in case of an unconditional operation, th ey are always updated in accord ance with the operation result. the definition of the dc bit is selected by the cs[2:0] (condition selection) bits in dsr. the dc bit result is: 1. carry or borrow mode: cs[2:0] = 000 the dc bit indicates the last shifted out data as the operation result. 2. negative value mode: cs[2:0] = 001 the dc bit is set when the operation result is a negative value, and cleared when the operation result is zero or a positive value. 3. zero value mode: cs[2:0] = 010 the dc bit is set when the operation re sult is zero; otherwise it is cleared. 4. overflow mode: cs[2:0] = 011 the dc bit is always cleared. 5. signed greater than mode: cs[2:0] = 100 the dc bit is always cleared. 6. signed greater than or equal mode: cs[2:0] = 101 the dc bit is always cleared. the n bit always indicates the same state as the dc bit set in negative value mode by the cs[2:0] bits. see the negative value mode part above. the z bit always indicates th e same state as the dc bit set in zero value mode by the cs[2:0] bits. see the zero value mode part above. the v bit always indicates the same state as the dc bit set in overflow mode by the cs[2:0] bits. see the overflow mode part above. the gt bit always indi cates the same state as the dc bit set in signed greater than mode by the cs[2:0] bits. see the signed greater than mode part above.
section 3 dsp operation rev. 4.00 sep. 14, 2005 page 111 of 982 rej09b0023-0400 overflow protection: the s bit in sr is also effective for arithmetic shift operation in the dsp unit. see section 3.1.8, overflow protection, for details. logical shift: figure 3.10 shows the logical shift operation flow. dsr gt z n v dc updated 7g 0g 31 16 15 0 sy 7g 0g 31 16 15 0 shift out shift out 0 0 cleared left shift right shift 7g 0g 31 22 21 16 imm2 50 15 0 shift amount data: (source 2) > = 0 < 0 +16 to ?16 ignored figure 3.10 logical shift operation flow as shown in figure 3.10, the logical shift operation uses the upper word of the source 1 operand and the destination operand. the lower word and guard-bit parts are ignored for the source operand and those of the destination operand ar e automatically cleared as in the alu logical operations. the shift amount is specified by the so urce 2 operand as an integer data. the source 2 operand can be specified by either the register or immediate operand. the available shift range is from ?16 to +16. here, a negative value means the right shift, and a positive value means the left shift. it is possible for any source 2 operand to specify from ?32 to +31, but the result is unknown if an invalid shift value is specified. in case of a shift with an immediate operand instruction, the source 1 operand must be the same register as the destination's. these operations are executed in the dsp stage, as shown in figure 3.2. the dsp st age is the same stage as the ma stage in which memory access is performed. every time a logical shift operation is executed, th e dc, n, z, v and gt bits in dsr are basically updated in accordance with the operation result. in case of a conditional operation, they are not updated even though the specified condition is true and the operation is executed. in case of an unconditional operation, they are always updated in accordance with the operation result. the definition of the dc bit is selected by the cs0 to cs2 (condition selection) bits in dsr. the dc bit result is:
section 3 dsp operation rev. 4.00 sep. 14, 2005 page 112 of 982 rej09b0023-0400 1. carry or borrow mode: cs[2:0] = 000 the dc bit indicates the last shifted out data as the operation result. 2. negative value mode: cs[2:0] = 001 bit 31 of the operation result is loaded into the dc bit. 3. zero value mode: cs[2:0] = 010 the dc bit is set when the operation re sult is zero; otherwise it is cleared. 4. overflow mode: cs[2:0] = 011 the dc bit is always cleared. 5. signed greater than mode: cs[2:0] = 100 the dc bit is always cleared. 6. signed greater than or equal mode: cs[2:0] = 101 the dc bit is always cleared. the n bit always indicates the same state as the dc bit set in ne gative value mode by the cs[2:0] bits. see the negative value mode part above. the z bit always indicates th e same state as the dc bit set in zero value mode by the cs[2:0] bits. see the zero value mode part above. the v bit always indicates the same state as the dc bit set in overflow mode by the cs[2:0] bits, but it is always cleared in this oper ation. so is the gt bit. 3.1.6 most significant bit detection operation the pdmsb, most significant bit detection operation, is used to calculate the shift amount for normalization. figure 3.11 shows the pdmsb operation flow and table 3.8 shows the operation definition. table 3.9 shows the possible variations of this type of operation. the correspondence between each operand and registers is the same as for alu fixed-point operations, as shown in table 3.2. note: the result of the msb detection operation is basically 24 bits as well as alu integer operation, the upper 16 bits of the base precision and 8 bits of the guard-bit parts. when a register not providing the guard-bit parts is specified as a destination operand, the upper word of the operation result is input into the destination register. as shown in figure 3.11, the pdmsb operation uses all bits as a so urce operand, but the destination operand is treated as an integer op eration result because shift amount data for normalization should be integer data as described in section 3.1.5 shift operations, arithmetic shift. these operations are execute d in the dsp stage, as shown in figure 3.2. the dsp stage is the same stage as the ma stage in which memory access is performed.
section 3 dsp operation rev. 4.00 sep. 14, 2005 page 113 of 982 rej09b0023-0400 every time a pdmsb operation is executed, the dc, n, z, v, and gt bits in dsr are basically updated in accordance with the operation result. in case of a conditional operation, they are not updated, even though the specified condition is tr ue, and the operation is executed. in case of an unconditional operation, they are always updated with the operation result. 39 31 0 guard 0 destination dsr gt z n v dc cleared source 1 or 2 priority encoder guard 39 31 figure 3.11 pdmsb operation flow the definition of the dc bit is selected by the cs0 to cs2 (condition selection) bits in dsr. the dc bit result is: 1. carry or borrow mode: cs[2:0] = 000 the dc bit is always cleared. 2. negative value mode: cs[2:0] = 001 the dc bit is set when the operation result is a negative value, and cleared when the operation result is zero or a positive value. 3. zero value mode: cs[2:0] = 010 the dc bit is set when the operation re sult is zero; otherwise it is cleared. 4. overflow mode: cs[2:0] = 011 the dc bit is always cleared. 5. signed greater than mode: cs[2:0] = 100 the dc bit is set when the operation result is a positive value; otherwise it is cleared. 6. signed greater than or equal mode: cs[2:0] = 101 the dc bit is set when the operation result is zer o or a positive value; otherwise it is cleared.
section 3 dsp operation rev. 4.00 sep. 14, 2005 page 114 of 982 rej09b0023-0400 table 3.8 operation definition of pdmsb source data result for dst guard bit upper word lower word guard bit upper word 7g 6g ? 1g 0g31 30 29 28 ? 3210 7g to 0g 31 to 22 21 20 19 18 17 16 decimal 0 0 ? 0 0 0 0 0 0 ? 0000all 0all 00111 1 1 +31 0 0 ? 0 0 0 0 0 0 ? 0001all 0all 00111 1 0 +30 0 0 ? 0 0 0 0 0 0 ? 0 0 1 * all 0all 00111 0 1 +29 0 0 ? 0 0 0 0 0 0 ? 0 1 * * all 0all 00111 0 0 +28 : : : 0 0 ? 0 0 0 0 0 1 ? * * * * all 0all 00000 1 0 +2 0 0 ? 0 0 0 0 1 * ? * * * * all 0all 00000 0 1 +1 0 0 ? 0 0 0 1 * * ? * * * * all 0all 00000 0 0 0 0 0 ? 0 0 1 * * * ? * * * * all 1all 11111 1 1 ?1 0 0 ? 0 1 * * * * ? * * * * all 1all 11111 1 0 ?2 : : : 0 1 ? * * * * * * ? * * * * all 1all 11110 0 0 ?8 1 0 ? * * * * * * ? * * * * all 1all 11110 0 0 ?8 : 1 1 ? 1 0 * * * * ? * * * * all 1all 11111 1 0 ?2 1 1 ? 1 1 0 * * * ? * * * * all 1all 11111 1 1 ?1 1 1 ? 1 1 1 0 * * ? * * * * all 0all 00000 0 0 0 1 1 ? 1 1 1 1 0 * ? * * * * all 0all 00000 0 1 +1 1 1 ? 1 1 1 1 1 0 ? * * * * all 0all 00000 1 0 +2 : : : 1 1 ? 1 1 1 1 1 1 ? 1 0 * * all 0all 00111 0 0 +28 1 1 ? 1 1 1 1 1 1 ? 1 1 0 * all 0all 00111 0 1 +29 1 1 ? 1 1 1 1 1 1 ? 1110all 0all 00111 1 0 +30 1 1 ? 1 1 1 1 1 1 ? 1111all 0all 00111 1 1 +31 note: * means don't care.
section 3 dsp operation rev. 4.00 sep. 14, 2005 page 115 of 982 rej09b0023-0400 table 3.9 variation of pdmsb operation mnemonic function source source 2 destination pdmsb msb detection sx ? dz ? sy dz the n bit always indicates the same state as the dc bit set in negative value mode by the cs[2:0] bits. see the negative value mode part above. the z bit always indicates th e same state as the dc bit set in zero value mode by the cs[2:0] bits. see the zero value mode part above. the v bit always indicates the same state as the dc bit se t in overflow mode by the cs[2:0] bits. see the overflow mode part above. the gt bit always indi cates the same state as the dc bit set in signed greater than mode by the cs[2:0] bits. see the signed greater than mode part above. 3.1.7 rounding operation the dsp unit provides the rounding function that rounds from 32 bits to 16 bits. in case of providing guard-bit parts, it rounds from 40 bits to 24 bits. when a round instruction is executed, h'00008000 is added to the source operand data an d then, the lower word is cleared. figure 3.12 shows the rounding operation flow and figure 3.13 shows the operation definition. table 3.10 shows the variation of this type of operation. the correspondence between each operand and registers is the same as alu fixed-point operations as shown in table 3.2. as shown in figure 3.12, the rounding operation uses full-size data for both source and destination operands. these operations are executed in the dsp stage as shown in figure 3.2. the dsp stage is the same stage as the ma stage in which memory access is performed. the rounding operation is always executed unconditionally, so that the dc, n, z, v, and gt bits in dsr are always updated in acco rdance with the operatio n result. the definition of the dc bit is selected by the cs[2:0] (condition selection) bits in dsr. the result of these condition code bits is the same as the alu-fixed point arithmetic operations.
section 3 dsp operation rev. 4.00 sep. 14, 2005 page 116 of 982 rej09b0023-0400 0 destination alu dsr cleared gt z n v dc h'00008000 39 31 0 source 1 or 2 addition guard guard 39 31 figure 3.12 rounding operation flow 0 h'00 0002 h'00 0001 h'00 0001 8000 h'00 0002 0000 h'00 0002 8000 rounded result analog value true value figure 3.13 definition of rounding operation table 3.10 variation of rounding operation mnemonic function source 1 source 2 destination prnd rounding sx ? dz ? sy dz overflow protection: the s bit in sr is effective for any rounding operations in the dsp unit. see section 3.1.8, overflow protection, for details.
section 3 dsp operation rev. 4.00 sep. 14, 2005 page 117 of 982 rej09b0023-0400 3.1.8 overflow protection the s bit in sr is effective for any arithmetic operations executed in the dsp unit, including the sh's standard multiply and mac operations. the s bit in sr, in sh's cpu core, is used as the overflow protection enable bit. the arithmetic operation overflows when the operation result exceeds the range of two's complement representa tion without guard-bit pa rts. table 3.11 shows the definition of overflow protection for fixed-point arithmetic operations, including fixed-point signed by signed multiplication described in section 3.1.4, fixed-point mult iply operation. table 3.12 shows the definition of overflow protection for integer arithmetic operations. when an sh's standard multiply or mac operation is executed, the s bit function is completely the same as the current sh cpu's definition. when the overflow protection is ef fective, overflow never occurs. so, the v bit is cleared, and the dc bit is also cleared when the overflow mode is selected by the cs[2:0] bits. table 3.11 definition of overflow protect ion for fixed-point arithmetic operations sign overflow condition fixed value hex representation positive result > 1 ? 2 ?31 1 ? 2 ?31 00 7fff ffff negative result < ?1 ?1 ff 8000 0000 table 3.12 definition of overflow prot ection for integer arithmetic operations sign overflow condition fixed value hex representation positive result > 2 15 ? 1 2 15 ? 1 00 7fff **** negative result < ?2 15 ?2 15 ff 8000 **** note: * means don't care.
section 3 dsp operation rev. 4.00 sep. 14, 2005 page 118 of 982 rej09b0023-0400 3.1.9 data transfer operation this lsi can execute a maximum of two data transf er operations between th e dsp register and the on-chip data memory in parallel for the dsp unit. three types of data transfer instructions are provided for the dsp unit. 1. parallel operation type (using xdb and ydb buses) 2. double data transfer type (using xdb or ydb buses) 3. single data transfer type (using ldb bus) the type 1 instructions execute both dsp data processing and data transfer operations in parallel. the 32-bit instruction code is used for this type of instruction. basically, two data transfer operations can be specified by this type of instruction, but they don't always have to be specified. one data transfer is for x memory and another is for y memory. both of these data transfer operations cannot be executed for one memory. a load instruction for x memory can specify either the x0 or x1 register as a destination operand and for a lo ad instruction for y memory can specify either the y0 or y1 register as a dest ination operand. both store operations for x and y memories can specify either the a0 or a1 register as a source operand. this type of operation treats only word data (16 bits). when a word data transfer operation is executed, the upper word of the register operand is used. in cas e of word data load, the data is loaded into the upper word of the destination register, and then the lower side of the destination is automatically cleared. when a conditional operation is specified as a da ta processing operation, the specified condition does not affect any data transfer operations. figure 3.14 shows this type of data transfer operation flow. this type of data transfer operation can access x or y memory only. any other memory space cannot be accessed.
section 3 dsp operation rev. 4.00 sep. 14, 2005 page 119 of 982 rej09b0023-0400 x pointer (r4, r5) 0, +2, +r8 xab [15:1] yab [15:1] xdb [15:0] ydb [15:0] 0, +2, +r9 y pointer (r6, r7) x memory (ram, rom) y memory (ram, rom) not affected for store and cleared for load cannot be specitied x0 x1 y0 y1 m0 m1 a0g a1g dsr a0 a1 figure 3.14 data transfer operation flow type 2 instructions execute just two data transfer operations. the 16-bit instruction code is used for this type of instructions. basically, operation and operand flexibility are the same as in type 1 but conditional operation is not su pported. this type of data tran sfer operation can access x or y memory only. any other memory space cannot be accessed. type 3 instructions execute single data transfer operations only. the 16-bit instruction code is used for this type of instructions. x pointers and other two extra pointers ar e available for this type of operation, but y pointers are not available. this type of operation can access any memory address space, and all registers in the dsp unit, except for dsr, can be specified for both source and destination operands. the gu ard-bit registers, a0g and a1g, can also be specified as independent registers. this type of operation can treat both single-wo rd data and longword data. when a word-data transfer operatio n is executed, the upper word of the regist er operand is activated. in case of word data load, the data is loaded into the upper word of the destination register, the lower side of the destination register is automatically cleared, and the signed bit is copi ed into the guard-bit parts, if supported. in case of longword data load, the data is loaded into the upper word and lower word of the destination register and the signed bit is sign-extended and copied into the guard-bit parts, if supported. in case of the guard register store, the signed bit is sign-extended and copied on the upper 24 bits of ldb. figures 3.15 and 3.16 show this type of data transfer operation flows.
section 3 dsp operation rev. 4.00 sep. 14, 2005 page 120 of 982 rej09b0023-0400 note: data transfer by an lds or sts instruction is possible si nce dsr is defined as a system register. lab [31:0] ldb [15:0] ?2, 0, +2, +r8 pointer (r2, r3, r4, r5) any memory areas not affected for store and cleared for load see description of a0g and a1g. cannot be specified x0 x1 y0 y1 m0 m1 dsr a0g a1g a0 a1 figure 3.15 single data-tra nsfer operation flow (word)
section 3 dsp operation rev. 4.00 sep. 14, 2005 page 121 of 982 rej09b0023-0400 lab [31:0] ldb [31:0] ?4, 0, +4, +r8 pointer (r2, r3, r4, r5) any memory areas cannot be specified x0 x1 y0 y1 m0 m1 a0g a1g a0 a1 dsr figure 3.16 single data-transfer operation flow (longword) all data transfer operations are executed in the ma stage of the pipeline. all data transfer operations do not u pdate any condition code bits in dsr.
section 3 dsp operation rev. 4.00 sep. 14, 2005 page 122 of 982 rej09b0023-0400 3.1.10 local data move instruction the dsp unit of this lsi provides additional two independent registers, macl and mach, in order to support sh's standard multiply/mac operations. they can be also used as temporary storage registers by local data move instructions between mach/l and other dsp registers figure 3.17 shows the flow of seven local data move instructions. table 3.13 shows the variation of this type of instruction. plds psts cannot be used x0 x1 mach macl y0 y1 m0 m1 a0 a1 a0g a1g dsr figure 3.17 local data move instruction flow table 3.13 variation of local data move operations mnemonic function operand plds data move from dsp register to macl/mach dz psts data move from macl/mach to dsp register dz this instruction is very similar to other transfer instructions. if either the a0 or a1 register is specified as the destination operand of psts, the signed bit is sign-extended and copied into the corresponding guard-bit parts, a0g or a1g. the dc bit in dsr and other condition code bits are not updated regardless of the instruction result. this instruction can operate with movx and movy in parallel.
section 3 dsp operation rev. 4.00 sep. 14, 2005 page 123 of 982 rej09b0023-0400 3.1.11 operand conflict when an identical destination operand is specified with multiple parallel instructions, data conflict occurs. table 3.14 shows th e correspondence between eac h operand and registers. table 3.14 correspondence be tween operands and registers x-memory load y-memory load 6-instruction alu 3-instruction multiply 3-instruction alu ax ix dx ay iy dy sx sy du se sf dg sx sy dz a0 * 1 * 2 * 2 * 1 * 1 a1 * 1 * 2 * 1 * 1 * 2 * 1 * 1 m0 * 1 * 1 * 1 * 1 m1 * 1 * 1 * 1 * 1 x0 * 2 * 1 * 2 * 1 * 1 * 1 * 2 x1 * 2 * 1 * 1 * 1 * 2 y0 * 2 * 1 * 2 * 1 * 1 * 1 * 2 dsp registers y1 * 2 * 1 * 1 * 1 * 2 notes: 1. registers available for operands 2. registers available for operand s (when there is operand conflict) there are three cases of operand conflict problems. 1. when alu and multiply instructions specify the same destination operand (du and dg) 2. when x-memory load and alu instructions specify the same destination operand (dx, du, and dz) 3. when y-memory load and alu instructions specify the same destination operand (dy, du, and dz) in these cases above, the result is not guaranteed.
section 3 dsp operation rev. 4.00 sep. 14, 2005 page 124 of 982 rej09b0023-0400 3.2 dsp addressing 3.2.1 dsp repeat control this lsi prepares a special cont rol mechanism for efficient repeat loop control. an instruction setrc sets the repeat times into the repeat counter rc (12 bits), and an execution mode in which a program loop executes repetitively until rc is equal to 1. after completion of the repeat instructions, the rc value becomes 0. repeat start address register rs keeps the start ad dress of a repeat loop. repeat end register re keeps the repeat end address. (there are some exceptions. see note, actual implementation options.) repeat counter rc keeps th e number of repeat times. in order to perform loop control, the following step s are required. step 1) set loop start address into rs step 2) set loop end address into re step 3) set repeat counter into rc step 4) start repeat control to do steps 1 and 2, use the following instructions: ldrs @(disp,pc) ldre @(disp,pc) for steps 3 and 4, use the setrc instruction. an operand of setrc is an immediate value or one of the general-purpose registers that will specify the repeat times. setrc #imm; #imm->rc, enable repeat control setrc rm; rm->rc, enable repeat control
section 3 dsp operation rev. 4.00 sep. 14, 2005 page 125 of 982 rej09b0023-0400 #imm is 8 bits while rc is 12 bits. therefore, to set more than 256 into rc, use rm. a sample program is shown below. ldrs rptstart; ldre rptend3+4; setrc #imm; rc = #imm instr0; ; instr1?5 executes repeatedly rptstart: instr1; rptend3: instr2; instr3; instr4; rptend: instr5; instr6; in this implementation, there are some restrictions to use this repeat control function as follows: 1. there must be at least one instruction between setrc and the first instruction in a repeat loop. 2. ldrs and ldre must be executed before setrc. 3. in a case that the repeat loop has four or mo re instructions in it, stall cycles are necessary according to the pipeline state at execution. 4. if a repeat loop has less than four instructions in it, it cannot have any branch instructions (bra, bsr, bt, bf, bt/s, bf/s, bsrf, rts, braf, rte, jsr and jmp), repeat control instructions (setrc, ldrs and ldre), load instructions for sr, rs, re, and a trapa instruction in it. if these instructions are executed, a general invalid instruction exception handling starts, and a certain address value shown in table 3.15 is stored into spc. table 3.15 address value to be stored into spc (1) condition location address to be pushed rc 2 any rptstart rc = 1 any address of the illegal instruction
section 3 dsp operation rev. 4.00 sep. 14, 2005 page 126 of 982 rej09b0023-0400 5. if a repeat loop has four or more instructions in it, any branch instructions (bra, bsr, bt, bf, bt/s, bf/s, bsrf, rts, braf, rte, js r and jmp), repeat control instructions (setrc, ldrs and ldre), load instructions for sr, rs, re, and the trapa instruction must not be written within the last three instructions from the bottom of a repeat loop. if written, a general invalid instruction exception handling starts, and a certain address value shown in table 3.16 is stored into spc. in cases of repeat control instructions (setrc, ldrs and ldre) and load instructions for sr, rs, and re, and the trapa instruction they cannot be placed in any other location of the repeat lo op, either. if they are, the operation is not guaranteed. table 3.16 address value to be stored into spc (2) condition location address to be pushed rc 2 instr3 address of the illegal instruction instr4 rptstart ? 4 instr5 rptstart ? 2 rc = 1 any address of the illegal instruction 6. if a repeat loop has less than four instructions in it, any pc relative instructions (mova @(disp, pc),r0, etc.) don't work properly except for the instructio n at the repeat top (instr1). 7. if a repeat loop has four or more instructions in it, any pc relative instructions (mova @(disp, pc),r0, etc.) don't work properly at two instructions from the bottom of the repeat loop. 8. the cpu has no repeat enable flag, however it uses the condition rc = 0 to disable repeat control. whenever the rc is not 0 and pc matche s re, the repeat control is alive. when 0 is set in the rc, the repeat control is disabled but the repeat loop is executed once and does not return to the repeat start as well as in the rc = 1 case. when rc = 1, the repeat loop is executed once and does not return to the repeat start but th e rc becomes 0 after completing the execution of the repeat loop. 9. if a repeat loop has four or more instructions in it, any branch instructions, including subroutine call and return instructions, cannot specify the instruction from inst3 to inst5 in the previous example as the branch target address. if executed, the repeat co ntrol doesn't work, so the program goes to the following instruction and the rc is not updated. when a repeat loop has less than four instructions in it, the repeat control doesn't work properly and the rc value in sr is not updated if the branch target is rptstart or a subsequent address. 10. exception acceptance is restrict ed during repeat loop processing . see figure 3.18 for details on restrictions.
section 3 dsp operation rev. 4.00 sep. 14, 2005 page 127 of 982 rej09b0023-0400 in figure 3.18, exceptions generated by instructions marked as b and c are handled as follows: ? interrupt and dma address errors an exception is accepted at neither instruction b or c, and the request is not even saved. a request is detected for the fi rst time and accepted when the ne xt instruction a is executed. interrupts and dma address errors are not accepted during a rep eat loop with four or less instructions, as shown in 1 to 4 in figure 3.18. ? user break before execution an exception is accepted at instru ction b, and the address of instruction b is stored into spc. an exception is not accepted at instruction c, but the request is saved, and is accepted just before the next instruction a or b is to be executed. the address of this next instruction a or b is stored into spc. ? user break after execution an exception is accepted at neith er instruction b nor c, but the request is saved, and is accepted just before the next instruction a or b is to be executed. the address of this next instruction a or b is stored into spc. ? cpu address error when a cpu address error occurs by executio n of instruction b or c, the exception is accepted, but the value stored in to spc is not the address of the instruction at where the exception occurred. therefore, return from the exception handler routine cannot be performed correctly. in this case, h'070 is set in expevt as the exception code (also see section 9, exception handling). to finish the repeat loop correctly, a cpu error must not be generated at instruction b or c. exception type instruction b instruction c interrupt not accepted not accepted dma address error not accepted not accepted udi break not accepted not accepted user break before execution not accepted not accepted user break after execution not accepted not accepted cpu address error accepted as exception code h'070 accepted as exception code h'070
section 3 dsp operation rev. 4.00 sep. 14, 2005 page 128 of 982 rej09b0023-0400 start(end): instr ? 1 instr0 instr1 instr2 ; a ; b ; c ; a 1. 1 repeated step a: acceptable for any interrupts b and c: acceptable for some interrupts rc = 0 : acceptable for any interrupts rc > 1 : _ 2. 2 repeated steps 4. 4 repeated steps 5. 5 or more repeated steps 3. 3 repeated steps start: end: instr ? 1 instr0 instr1 instr2 instr3 instr4 instr4 ; a ; a ; b ; c ; c ; c ; a start: end: instr ? 1 instr0 instr1 : : instr n ? 3 instr n ? 2 instr n ? 1 instr n instr n + 1 ; a ; a ; a ; b ; c ; c ; c ; a start: end: instr ? 1 instr0 instr1 instr2 instr3 ; a ; b ; c ; c ; a start: end: instr ? 1 instr0 instr1 instr2 instr3 instr4 ; a ; b ; c ; c ; c ; a figure 3.18 restriction of int errupt acceptance in repeat loop note 1: actual implementation repeat start and repeat end registers, rs and re, specify the repeat start in struction and repeat end instruction. the actual addresses that are kept in these registers depend on the number of instructions in the repeat loop. the rule is as follows: repeat_start: an address of the instruction at the repeat top repeat_start0: an address of the instructio n before one instruction at the repeat top repeat_end3: an address of the instruction befo re three instructions at the repeat bottom table 3.17 rs and re setting rule number of instructions in repeat loop 1 2 3 4 rs repeat_start0 + 8 repeat_start0 + 6 repeat_start0 + 4 repeat_start re repeat_start0 + 4 repeat_start0 + 4 repeat_start0 + 4 repeat_end3 + 4
section 3 dsp operation rev. 4.00 sep. 14, 2005 page 129 of 982 rej09b0023-0400 based on this table, the actual repeat programming for various cases should be described as in the following examples: case 1: 1 repeated instruction ldrs rptstart0+8; ldre rptstart0+4; setrc rptcount; - - - - rptstart0: instr0; rptstart: instr1; repeated instruction instr2; case 2: 2 repeated instructions ldrs rptstart0+6; ldre rptstart0+4; setrc rptcount; - - - - rptstart0: instr0; rptstart: instr1; repeated instruction 1 rptend: instr2; repeated instruction 2 instr3; case 3: 3 repeated instructions ldrs rptstart0+4; ldre rptstart0+4; setrc rptcount; - - - - rptstart0: instr0; rptstart: instr1; repeated instruction 1 instr2; repeated instruction 2 rptend: instr3; repeated instruction 3 instr4;
section 3 dsp operation rev. 4.00 sep. 14, 2005 page 130 of 982 rej09b0023-0400 case 4: 4 or more repeated instructions ldrs rptstart; ldre rptend3+4; setrc rptcount; - - - - rptstart0: instr0; rptstart: instr1; repeated instruction 1 instr2; repeated instruction 2 instr3; repeated instruction 3 ---------------------------------------------------------- rptend3: instrn-3; repeated instruction n-3 instrn-2; repeated instruction n-2 instrn-1; repeated instruction n-1 rptend: instrn; repeated instruction n instrn+1; the examples above can be used as a template to program this repeat loop sequences. however, for easy programming, an extended instruction repeat is provided to handle these complex labeling and offset issues. details will be described in the following note 2. note 2: extended instruction repeat this repeat extended instruction will handle all the delicate labeling and offset processing described in table 3.17 and note 1. the labels used here are: rptart: an address of the instruction at the top of the repeat loop rptend: an address of the instruction at the bottom of the repeat loop rptcount: repeat coun t immediate number this instruction can be used in the following way: here the repeat count can be specified as an imme diate value #imm or a regi ster indirect value rn.
section 3 dsp operation rev. 4.00 sep. 14, 2005 page 131 of 982 rej09b0023-0400 case 1: 1 repeated instruction repeat rptstart, rptstart, rptcount; - - - - instr0; rptstart: instr1; repeated instruction instr2; case 2: 2 repeated instructions repeat rptstart, rptend, rptcount; - - - - instr0; rptstart: instr1; repeated instruction 1 rptend: instr2; repeated instruction 2 case 3: 3 repeated instructions repeat rptstart, rptend, rptcount; - - - - instr0; rptstart: instr1; repeated instruction 1 instr2; repeated instruction 2 rptend: instr3; repeated instruction 3
section 3 dsp operation rev. 4.00 sep. 14, 2005 page 132 of 982 rej09b0023-0400 case 4: 4 or more repeated instructions repeat rptstart, rptend, rptcount; - - - - instr0; rptstart instr1; repeated instruction 1 instr2; repeated instruction 2 instr3; repeated instruction 3 ---------------------------------------------------------- instrn-3; repeated instruction n-3 instrn-2; repeated instruction n-2 instrn-1; repeated instruction n-1 rptend instrn; repeated instruction n instrn+1; the expanded results of each case corresponds to the same case numbers in note 1. 3.2.2 dsp data addressing this lsi has two types of memory access instru ctions: one type is x and y data transfer instructions (movx.w and movy.w), and the other is single data transfer instructions (movs.w and movs.l). data addressing of these two types of instruction are different. table 3.18 shows a summary of dsp data transfer instructions.
section 3 dsp operation rev. 4.00 sep. 14, 2005 page 133 of 982 rej09b0023-0400 table 3.18 summary of dsp data transfer instructions x and y data transfer operation (movx.w and movy.w) single data transfer operation (movs.w and movs.l) address registers ax: r4 and r5, ay: r6 and r7 as: r2, r3, r4 and r5 index register(s) ix: r8, iy: r9 is: r8 addressing operations not update/increment (+2)/ add-index-register post-update not update/increment (+2)/ add-index-register post-update decrement (?2, ?4): pre-update modulo addressing yes no data bus xdb and ydb ldb data length 16 bits (word) 16 bits/32 bits (word/longword) bus conflict no possible (same as the sh) memory x and y data memories all memory spaces source registers dx, dy: a0 and a1 ds : a0/a1, m0/m1, x0/x1, y0/y1, a0g, a1g destination registers dx: x0/x1, dy: y0/y 1 ds: a0/a1, m0/m1, x0/x1, y0/y1, a0g, a1g addressing for movx.w and mov.w: this lsi can access x and y data memories simultaneously (movx.w and movy.w). the dsp instructions have two address pointers that simultaneously access x and y data memories. the dsp instruction has only pointer-addressing (it does not have immediate-addressing). address registers are divided into two sets, r4 and r5 (ax: address register for x memory) and r6 and r7 (ay: address register for y memory). there are three data addressing types for x and y data transfer instructions. 1. not-update address register 2. add-index register 3. increment address register each address pointer set has an index register, r8 [ix] for set ax, and r9[iy] for set ay. address instructions for set ax use alu in the cpu, and address instructions for set ay use a different address unit (figure 3.19).
section 3 dsp operation rev. 4.00 sep. 14, 2005 page 134 of 982 rej09b0023-0400 three address operation types: 1. not update 2. add-index-register (ix/iy) 3. increment all operations are post-update type. to decrement an address pointer, set ?2 in an index register. alu r8 [ix] r4 [ax] r5 [ax] +2 (inc) +0 (not update) au r9 [iy] r6 [ay] r7 [ay] +2 (inc) +0 (not update) additional adder for dsp addressing figure 3.19 dsp addressing inst ructions for movx.w and movy.w addressing in x and y data transf er operation is always word mode ; that is access to x and y data memories are 16-bit data width. therefore, the in crement operation adds 2 to an address register. to realize decrement, set ?2 in an index register and use add-index-register operation. addressing for movs: this lsi has single-data transfer instructions (movs.w and movs.l) to load/store dsp data registers. in these instru ctions, r2 to r5 (as: address register for single- data transfer) are used for the addres s pointer. there are four data addressing type s for single-data transfer operation. 1. not-update address register 2. add-index register (post-update) 3. increment address register (post-update) 4. decrement address re gister (pre-update) the address pointer set as has an index register r8[is] (figure 3.20)
section 3 dsp operation rev. 4.00 sep. 14, 2005 page 135 of 982 rej09b0023-0400 alu r8 [is] r4 [as] r5 [as] r2 [as] r3 [as] ?2/?4 (dec) +2/+4 (inc) +0 (no update) four address operation types: 1. not update 2. add-index-register (is) 3. increment 4. decrement post-update pre-update figure 3.20 dsp addressing instructions for movs modulo addressing: this lsi provides modulo addressing mode, which is common in dsps. in modulo addressing mode, the address register is updated as explained above. when the address pointer reaches the pre-defined address (modulo-end address), it goes to the modulo star t address. modulo addressing is available for x and y data transfer instructions (movx and movy), but not for the single-data transfer instruction (movs). dmx and dmy in sr are used for the modulo addressing control. if dmx is 1, the modulo addressing mode is effective for the x memory address pointer ax (r4 or r5). if the dmy is 1, it is effective for the y memory address pointer ay (r6 or r7). modulo addressing is available for one of x and y address registers at one time. a dmx = dmy = 1 case is reserved for future expansion. when both dmx and dmy are set simultaneously, the hardware will preliminary assume that the modulo addressing mode is effective for the y address pointer only. to specify the start and end ad dresses of the modulo address area, the mod register, which includes ms (modulo start) and me (modulo end) is prepared. the following example shows a way to set the mod (ms and me) register. mov.l modaddr,rn; rn=modend, modstart ldc rn,mod; me=modend, ms=modstart modaddr: .data.w mend; lower 16 bits of modend .data.w mstart; lower 16 bits of modstart modstart: .data : modend: .data
section 3 dsp operation rev. 4.00 sep. 14, 2005 page 136 of 982 rej09b0023-0400 ms and me are set to specify the start and end a ddresses, and then later to set the dmx or dmy bit to 1. when the x/y data transfer instruction set in dmx/dmy is executed, the address register contents before update are compared with me* 1 . if they match, modulo st art address ms is stored in the address register as the updated value* 2 . if non-update address register addressing is specified for the x/y data transfer instruction, the address pointer will not return to modulo start address ms even though the addr ess register contents match me. notes: 1. bits 1 to 15 of the address register are used for comparison. though me retains its previous value for bit 0, 0 must always be written to bit 0. 2. the ms value is stored in bits 1 to 15 of the address register. though ms retains its previous value for bit 0, 0 must always be written to bit 0. the maximum modulo size is 64-kbyte s. this is sufficient for accessi ng the x or y data memory. figure 3.21 shows a block diagram of modulo addressing. alu r8 [ix] 31 31 1615 dmx dmy instr (movx/y) 15 15 1 1 0 0 r9 [iy] 31 0 r4 [ax] r5 [ax] abx 15 1 15 1 me 31 1615 15 1 0 +2 +0 +2 +0 au abx xab ya b ms cmp cont r6 [ay] r7 [ay] figure 3.21 modulo addressing
section 3 dsp operation rev. 4.00 sep. 14, 2005 page 137 of 982 rej09b0023-0400 an example is shown below. ms=h'7000; me=h'7004; r4=h'a5007000; dmx=1; dmy=0 (modulo addressing for address register ax) as a result of the above settings, th e r4 register changes as follows. ; r4: h'a5007000 (initial value) movx.w @r4+,dx ; r4: h'a5007000 h'a5007002 movx.w @r4+,dx ; r4: h'a5007002 h'a5007004 movx.w @r4+,dx ; r4: h'a5007004 h'a5007000 (after reading h'a5007004, ms value is written to address register) movx.w @r4+,dx ; r4: h'a5007000 h'a5007002 place the data so that the upper 16 bits of the m odulo start and end addresse s are the same. this is because the modulo star t address overwrites only the lower 16 bits of the address register. note: when addition index is the data addressing type for x and y data transfer instructions, the address pointer may exceed the me value without actually reach ing it. in this case, the address pointer will not return to the modulo start address. not only with modulo addressing, but when x and y data addressing is used, bit 0 is ignored. 0 must always be written to bit 0 of the address pointer, index register, ms, and me.
section 3 dsp operation rev. 4.00 sep. 14, 2005 page 138 of 982 rej09b0023-0400 addressing instructions in execution stage: address instructions, including modulo addressing, are executed in the execution stage of the pipeline. behavior of the dsp data addressing in the execution stage is shown below. if ( operation is movx.w movy.w ) { abx=ax; aby=ay; /* memory access cycle uses abx and aby. the addresses to be used have not been updated. */ /* ax is one of r4,5 */ if { dmx==0 || ( dmx==1 && dmy==1 )} ax = ax+(+2 or r8[ix] or +0); /* inc,index,not-update */ else if (! not-update) ax=modulo( ax, (+2 or r8[ix]) ); /* ay is one of r6,7 */ if ( dmy==0 ) ay=ay+(+2 or r9[iy] or +0); /* inc,index,not-update */ else if (! not-update) ay=modulo( ay, (+2 or r9[iy]) ); } else if ( operation is movs.w or movs.l ) { if ( addressing is nop, inc, add-index-reg ) { mab=as; /* memory access cycle uses mab. the address to be used has not been updated.*/ /* as is one of r2 to r5 */ as = as+(+2 or +4 or r8[is] or +0); /* inc,index,not-update */ else { /* decrement, pre-update */ /* as is one of r2 to r5 */ as=as+(-2 or -4); mab=as; /* memory access cycle uses mab. the address to be used has been updated. */ }
section 3 dsp operation rev. 4.00 sep. 14, 2005 page 139 of 982 rej09b0023-0400 /* the value to be added to the address register depends on addressing instructions. for example, (+2 or r8[ix] or +0) means that +2: if instruction is increment r8[ix]: if instruction is add-index-register +0: if instruction is not-update */ function modulo ( addrreg, index ) { if ( addrreg[15:1]==me[15:1] ) addrreg[15:1]==ms[15:1]; else addrreg=addrreg+index; return addrreg; } x and y data transfer instructions (movx.w and movy.w): this type of instruction uses the xdb and the ydb to access x and y data memories (they cannot access other memory spaces). these two buses are separate from the instruction bus, therefore, there is no access conflict between data memory access and instruction memory access. figure 3.22 shows load/store control for x and y data transfer instructions. all memory accesses are word mode accesses.
section 3 dsp operation rev. 4.00 sep. 14, 2005 page 140 of 982 rej09b0023-0400 31 15 1 0 r4 [ax] r5 [ax] abx xab 16-bit x_mem x r/w y_mem y r/w yab 16-bit xdb ydb 16-bit 16-bit x data memory 4 kbytes 31 15 1 0 r6 [ay] r7 [ay] aby y data memory 4 kbytes x_mem and y_mem: select x and y data memory instruction code for x data-transfer operation instruction code for y data-transfer operation control for x memory control for y memory input/output control for dsp data registers x0/x1, a0/a1 input/output control for dsp data registers y0/y1, a0/a1 figure 3.22 load/store control for x and y data-transfer instructions control for x memory: if ( !nop ) { x_mem=1; xab=abx; if ( load operation ) { dx[31:16]=xdb; dx[15:0]=0x0000; / * dx is x0 or x1 */ } else xdb = dx[31:16]; / * dx is a0 or a1 */ } else { x_mem=0; xab=0x000; } the conditional execution based on the dc flag in dsr cannot control any movx/movy instructions.
section 3 dsp operation rev. 4.00 sep. 14, 2005 page 141 of 982 rej09b0023-0400 single-data transfer instructions (movs.w and movs.l): this lsi has single load/store instructions for the dsp registers. it is similar to a load/store instruction for a system register. it transfers data between memory and dsp data registers using lab and ldb buses. there may be access conflict between data access and instruction fetch. the single-data transfer instru ction has word and longword acces s modes. figure 3.23 shows a block diagram of single-data transfer. the existing cpu core's hardware resource is used for control of the memory address buffer (mab) and memory selection. 31 0 r2 [as] r3 [as] r4 [as] r5 [as] lab 31 0 mab input/output control for dsp data registers memory 32-bit ldb 32-bit instruction code for single data transfer operation control in cpu as ms wl ls ds control figure 3.23 load/sto re control for si ngle-data transfer instruction
section 3 dsp operation rev. 4.00 sep. 14, 2005 page 142 of 982 rej09b0023-0400 control lab=mab; if ( ms!=nls && w/l is word access ) { /* movs.w */ if (ls==load) { if (ds!=a0g && ds!=a1g) { ds[31:16] = ldb[15:0]; ds[15:0] = 0x0000; if (ds==a0) a0g[7:0] = sign-extension of ldb; if (ds==a1) a1g[7:0] = sign-extension of ldb; } else ds[7:0] = ldb[7:0]; / * ds is a0g or a1g * / } else { /* store */ if (ds!=a0g && ds!=a1g) ldb[15:0] = ds[31:16]; /* ds is a0g or a1g */ else ldb[15:0] = ds[7:0] with 8bit sign-extension; } } else if ( ma!=nls && w/l is long-word access ) { /* movs.l */ if (ls==load) { if (ds!=a0g && ds!=a1g) { ds[31:0] = ldb[31:0]; if (ds==a0) a0g[7:0] = sign-extension of ldb; if (ds==a1) a1g[7:0] = sign-extension of ldb; } else ds[7:0] = ldb[7:0]; /* ds is a0g or a1g */ } else { /* store */ if (ds!=a0g && ds!=a1g) ldb[31:0] = ds[31:0]; /* ds is a0g or a1g */ else ldb[31:0] = ds[7:0] with 24bit sign-extension; } }
section 4 clock pulse generator (cpg) rev. 4.00 sep. 14, 2005 page 143 of 982 rej09b0023-0400 section 4 clock pulse generator (cpg) this lsi has a clock pulse generator (cpg) that generates an internal clock (i ), a peripheral clock (p ), and a bus clock (b ). the cpg consists of an oscillator, pll circuit, and divider circuit. 4.1 features the cpg has the following features. ? three clock modes the mode is selected fr om among the three clock modes by the selection of the following three conditions: the frequency-divisor in use, whether the pll is on or off, and whether the internal crystal resonator or the input on the external clock-signal line is used. ? three clocks generated independently an internal clock (i ) for the cpu and cache; a peripheral clock (p ) for the on-chip peripheral modules; a bus clock (b = ckio) for the external bus interface. ? frequency change function internal and peripheral clock frequencies can be changed independently using the pll (phase locked loop) circuit and divider circuit within the cpg. frequencies are changed by software using frequency control register (frqcr) settings. ? power-down mode control the clock can be stopped for sleep mode, an d standby mode and sp ecific modules can be stopped using the module standby function. for details on clock control in the low-power consumption modes, see section 6, power-down modes. a block diagram of the cpg is given in figure 4.1.
section 4 clock pulse generator (cpg) rev. 4.00 sep. 14, 2005 page 144 of 982 rej09b0023-0400 ckio ckio2 pll circuit 1 (1, 2, 3, 4) 1 1/2 1/3 1/4 clock pulse generator divider internal clock (i) internal bus bus interface frqcr: stbcr: stbcr2: stbcr3: stbcr4: [legend] frequency control register standby control register standby control register 2 standby control register 3 standby control register 4 peripheral clock (p) bus clock (b = ckio) extal md2 md0 xtal frqcr stbcr stbcr2 stbcr3 stbcr4 cpg control unit clock frequency control circuit standby control circuit pll circuit 2 ( 2,4) crystal oscillator figure 4.1 block diagram of clock pulse generator
section 4 clock pulse generator (cpg) rev. 4.00 sep. 14, 2005 page 145 of 982 rej09b0023-0400 the clock pulse generator blocks function as follows: pll circuit 1: pll circuit 1 doubles, triples, or quadruples, the input clock frequency from the ckio pin. the multiplication rate is set by the frequency control register. when this is done, the phase of the rising edge of the internal clock is controlled so that it will agree with the phase of the rising edge of the ckio pin. pll circuit 2: pll circuit 2 doubles, or quadruples the input clock frequency from the crystal oscillator or extal pin. the mu ltiplication rate is fixed according to the clock operating mode. the clock operating mode is specified by the md0, and md2 pins. for details on clock operating mode, see table 4.2. crystal oscillator: the crystal oscillator is an oscillator circuit in which a crystal resonator is connected to the xtal pin or extal pin. this can be used according to the clock operating mode. divider: the divider generates a clock signal at the operating frequency used by the internal or peripheral clock. the operating frequency can be 1, 1/2, 1/3 or 1/4 times the output frequency of pll circuit 1, as long as it stays at or above the clock frequency of the ckio pin. the division ratio is set in the frequency control register. clock frequency control circuit: the clock frequency control circuit controls the clock frequency using the md0, and md2 pins and the frequency control register. standby control circuit: the standby control circuit contro ls the states of the clock pulse generator and other modules during clock switching or sleep, or standby modes. frequency control register: the frequency control register has control bits assigned for the following functions: clock output/non-output from the ckio pin during standby modes, the frequency multiplication ratio of pll circuit 1, and the frequency division ratio of the internal clock and the peripheral clock. standby control register: the standby control register has bits for controlling the power-down modes. see section 6, power-down modes, for more information.
section 4 clock pulse generator (cpg) rev. 4.00 sep. 14, 2005 page 146 of 982 rej09b0023-0400 4.2 input/output pins table 4.1 lists the cpg pins and their functions. table 4.1 pin configuration and func tions of the clock pulse generator pin name symbol i/o function (clock operating modes 2 and 6) function (clock operating mode 7) mode control pins md0 input set the clock operating mode. md2 input set the clock operating mode. xtal output connected to the crystal re sonator (leave this pin open-circuit when the crystal resonator is not in use). crystal input/output pins (clock input pins) extal input connected to the crystal resonator or used to input an external clock. clock input/output pin ckio i/o cl ock output pin. the pin can also be placed in the high-impedance state. input for the external clock pulse. clock-output pin ckio2 output low-lev el output or clock output pin. the selection is described in the description of the common control registers in section 12, bus state controller (bsc). high impedance 4.3 clock operating modes table 4.2 shows the relationship between the mode control pins (md2 and md0) combinations and the clock operating modes. table 4.3 shows th e usable frequency ranges in the clock operating modes. table 4.2 clock operating modes pin values clock i/o mode md2 md0 source output pll2 on/off pll1 on/off ckio frequency 2 0 0 extal or crystal resonator ckio on ( 4) on ( 1, 2) (extal or crystal resonator) 4 6 1 0 extal or crystal resonator ckio on ( 2) on ( 1, 2, 3, 4) (extal or crystal resonator) 2 7 1 1 ckio ? off on ( 1, 2, 3, 4) (ckio)
section 4 clock pulse generator (cpg) rev. 4.00 sep. 14, 2005 page 147 of 982 rej09b0023-0400 mode 2: the frequency of the signal received from the extal pin or crystal resonator lsi is quadrupled by the pll circuit 2 before it is supplie d as the clock signal. this lowers the frequency required of the externally generated clock. either a crystal resonator with a frequency in the range from 10 to 12.5 mhz or an external signal in the same frequency range input on the extal pin may be used. the frequency range of ckio is from 40 to 50 mhz. mode 6: the frequency of the signal received from the extal pin or crystal resonator lsi is doubled by the pll circuit 2 before it is supplied as the clock signal. this lowers the frequency required of the crystal resonator. a crystal resonato r or an external signal with a frequency in the range from 10 to 25 mhz may be used. the frequency range of ckio is from 20 to 50 mhz. mode 7: in this mode, the ckio pin functions as an input pin. an external clock signal is supplied to this pin; after this signal is recei ved, the pll circuit 1 shapes its waveform and multiplies its frequency. the resulting clock signal is then supplied within the lsi. for reduced current and hence power consumption, pull up the extal pin and open the xtal pin when the lsi is used in mode 7. table 4.3 relationship between clock mode and frequency range pll frequency multiplier selectable frequency ra nges (mhz) clock operating mode frqcr register setting pll circuit 1 pll circuit 2 ratio of internal clock frequencies (i:b:p) input clock output clock (ckio pin) internal clock bus clock peripheral clock 2 h'1001 on (1) on (4) 4:4:2 10 to 12.5 40 to 50 40 to 50 40 to 50 20 to 25 h'1002 on (1) on (4) 4:4:4/3 10 to 12.5 40 to 50 40 to 50 40 to 50 13.33 to 16.66 h'1003 on (1) on (4) 4:4:1 10 to 12.5 40 to 50 40 to 50 40 to 50 10 to 12.5 h'1103 on (2) on (4) 8:4:2 10 to 12.5 40 to 50 80 to 100 40 to 50 20 to 25 h'1113 on (2) on (4) 4:4:2 10 to 12.5 40 to 50 40 to 50 40 to 50 20 to 25 6 h'1000 on (1) on (2) 2:2:2 10 to 16.66 20 to 33.33 20 to 33.33 20 to 33.33 20 to 33.33 h'1001 on (1) on (2) 2:2:1 10 to 25 20 to 50 20 to 50 20 to 50 10 to 25 h'1002 on (1) on (2) 2:2:2/3 10 to 25 20 to 50 20 to 50 20 to 50 6.66 to 16.66 h'1003 on (1) on (2) 2:2:1/2 10 to 25 20 to 50 20 to 50 20 to 50 5 to 12.5 h'1101 on (2) on (2) 4:2:2 10 to 16.66 20 to 33.33 40 to 66.66 20 to 33.33 20 to 33.33 h'1103 on (2) on (2) 4:2:1 10 to 25 20 to 50 40 to 100 20 to 50 10 to 25 h'1111 on (2) on (2) 2:2:2 10 to 16.66 20 to 33.33 20 to 33.33 20 to 33.33 20 to 33.33 h'1113 on (2) on (2) 2:2:1 10 to 25 20 to 50 20 to 50 20 to 50 10 to 25 h'1202 on (3) on (2) 6:2:2 13.33 to 16.66 26.66 to 33.33 80 to 100 26.66 to 33.33 26.66 to 33.33 h'1222 on (3) on (2) 2:2:2 13.33 to 16.66 26.66 to 33.33 26.66 to 33.33 26.66 to 33.33 26.66 to 33.33
section 4 clock pulse generator (cpg) rev. 4.00 sep. 14, 2005 page 148 of 982 rej09b0023-0400 pll frequency multiplier selectable frequency ra nges (mhz) clock operating mode frqcr register setting pll circuit 1 pll circuit 2 ratio of internal clock frequencies (i:b:p) input clock output clock (ckio pin) internal clock bus clock peripheral clock 6 h'1303 on (4) on (2) 8:2:2 10 to 12.5 20 to 25 80 to 100 20 to 25 20 to 25 h'1313 on (4) on (2) 4:2:2 10 to 16.66 20 to 33.33 40 to 66.66 20 to 33.33 20 to 33.33 h'1333 on (4) on (2) 2:2:2 10 to 16.66 20 to 33.33 20 to 33.33 20 to 33.33 20 to 33.33 7 h'1000 on (1) off 1:1:1 20 to 33.33 20 to 33.33 20 to 33.33 20 to 33.33 20 to 33.33 h'1001 on (1) off 1:1:1/2 20 to 50 20 to 50 20 to 50 20 to 50 10 to 25 h'1002 on (1) off 1:1:1/3 20 to 50 20 to 50 20 to 50 20 to 50 6.66 to 16.66 h'1003 on (1) off 1:1:1/4 20 to 50 20 to 50 20 to 50 20 to 50 5 to 12.5 h'1101 on (2) off 2:1:1 20 to 33.33 20 to 33.33 40 to 66.66 20 to 33.33 20 to 33.33 h'1103 on (2) off 2:1:1/2 20 to 50 20 to 50 40 to 100 20 to 50 10 to 25 h'1111 on (2) off 1:1:1 20 to 33.33 20 to 33.33 20 to 33.33 20 to 33.33 20 to 33.33 h'1113 on (2) off 1:1:1/2 20 to 50 20 to 50 20 to 50 20 to 50 10 to 25 h'1202 on (3) off 3:1:1 26.66 to 33.33 26.66 to 33.33 80 to 100 26.66 to 33.33 26.66 to 33.33 h'1222 on (3) off 1:1:1 26.66 to 33.33 26.66 to 33.33 26.66 to 33.33 26.66 to 33.33 26.66 to 33.33 h'1303 on (4) off 4:1:1 20 to 25 20 to 25 80 to 100 20 to 25 20 to 25 h'1313 on (4) off 2:1:1 20 to 33.33 20 to 33.33 40 to 66.66 20 to 33.33 20 to 33.33 h'1333 on (4) off 1:1:1 20 to 33.33 20 to 33.33 20 to 33.33 20 to 33.33 20 to 33.33 notes: 1. the ratio of clock frequencies, where the input clock frequency is assumed to be 1. 2. in modes 2 and 6, the frequency of t he clock input from the extal pin or the frequency of the crystal resonator. in m ode 7, the frequency of the clock input from the ckio pin. caution: 1. the frequency of the internal clock is the frequency of the signal input to the ckio pin after multiplication by the frequency-mult iplier of pll circuit 1 and division by the divider's divisor. do not set a frequency fo r the internal clock below the frequency of the signal on the ckio pin. 2. the frequency of the peripheral clock is the frequency of the signal input to the ckio pin after multiplication by the frequency-mult iplier of pll circuit 1 and division by the divider's divisor. set the frequency of the peripheral clock to 33.33 mhz or below. in addition, do not set a higher frequency for the internal clock than the frequency on the ckio pin. 3. the frequency multiplier of the pll circ uit can be selected as x1, x2, x3 or x4. the divisor of the divider can be selected as x1 , x1/2, x1/3 or x1/4. the settings are made in the respective frequency-control registers. 4. the signal output by pll circuit 1 is the signal on the ckio pin multiplied by the frequency multiplier of pll circuit 1. ensure that the frequency of the signal from pll circuit 1 is no more than 100 mhz.
section 4 clock pulse generator (cpg) rev. 4.00 sep. 14, 2005 page 149 of 982 rej09b0023-0400 4.4 register descriptions the cpg's control register is ca lled the frequency control register (frqcr). refer the section 24, list of registers, for the addresses of the regist ers and the state of each register in each processor state. 4.4.1 frequency control register (frqcr) the frequency control register (frqcr) is a 16-b it readable/writable register used to specify whether a clock is output from the ckio pin, the frequency multiplication ratio of pll circuit 1, and the frequency division ratio of the internal clock and the peripheral clock. only word access can be used on the frqcr register. this register is initialized (to h'1003) only in the case of a power-on reset. this register retains its previous value after a manual reset or period in standby mode. the previous value is also retained when an internal reset is triggered by an overflow of the wdt. bit bit name initial value r/w description 15 to 13 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 12 ckoen 1 r/w clock output enable ckoen specifies whether a clock is output from the ckio and ckio2 pins, or whether the ckio and ckio2 pins is placed in the level-fixed state during release of the standby mode (until the state enters status1 = l and status0 = l from an interrupt). if ckoen is cleared to 0, the ckio and ckio2 pins are fixed at low during stat us1 = l and status0 = h. therefore, the malfunction of an external circuit because of an unstable ckio clock during release of the standby mode can be prevented. in clock operating mode 7, the ckio pin functions as an input regardless of this bit value. 0: the ckio pin is fixed to the low level in the standby mode and while the system is leaving standby mode. 1: clock is output from ckio pin (placed in the high- impedance state during periods in standby mode).
section 4 clock pulse generator (cpg) rev. 4.00 sep. 14, 2005 page 150 of 982 rej09b0023-0400 bit bit name initial value r/w description 11, 10 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 9 8 stc1 stc0 0 0 r/w r/w frequency multiplication ratio of pll circuit 1 00: 1 time 01: 2 times 10: 3 times 11: 4 times 7, 6 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 5 4 ifc1 ifc0 0 0 r/w r/w internal clock frequency division ratio these bits specify the frequency division ratio of the internal clock with respect to the output frequency of pll circuit 1. 00: 1 time 01: 1/2 time 10: 1/3 time 11: 1/4 time 3, 2 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 1 0 pfc1 pfc0 1 1 r/w r/w peripheral clock frequency division ratio these bits specify the division ratio of the peripheral clock frequency with respect to the output frequency of pll circuit 1. 00: 1 time 01: 1/2 time 10: 1/3 time 11: 1/4 time
section 4 clock pulse generator (cpg) rev. 4.00 sep. 14, 2005 page 151 of 982 rej09b0023-0400 4.5 changing the frequency the frequency of the internal clock and peripheral clock can be changed either by changing the multiplication rate of pll circuit 1 or by changing the division rates of divider. all of these are controlled by software through the frequency control register. the methods are described below. 4.5.1 changing the multiplication rate a pll settling time is required when the multiplicati on rate of pll circuit 1 is changed. the on- chip wdt counts the settling time. 1. in the initial state, the multiplication rate of pll circuit 1 is 1. 2. set a value that will become the specified os cillation settling time in the wdt and stop the wdt. the following must be set: wtcsr register tme bit = 0: wdt stops wtcsr register cks2 to cks0 bits: division ratio of wdt count clock wtcnt counter: initial counter value 3. set the desired value in the stc1 and stc0 bits. the division ratio can also be set in the ifc[1:0] and pfc[1:0] bits. 4. the processor pauses temporarily and the wdt starts incrementing. the internal and peripheral clocks both stop and the wdt is supplied with the clock. the clock will continue to be output at the ckio pin. this state is the same as the standby state. whether or not registers are initialized depends on the module. for details, see table 6.3, register states in standby mode in section 6, power-down modes. 5. supply of the clock that has been set begins at wdt count overflow, and the processor begins operating again. the wdt stops after it overflows. 4.5.2 changing the division ratio counting by the wdt does not pro ceed if the frequency divisor is changed but the multiplier is not. 1. in the initial state, ifc[1:0] = b'00 and pfc[1:0] = b'11 2. set the desired value in the ifc[1:0] and pfc[1:0] bits. the values that can be set are limited by the clock mode and the multiplication rate of pl l circuit 1. note that if the wrong value is set, the processor will malfunction. 3. the clock is immediately supplied at the new division ratio.
section 4 clock pulse generator (cpg) rev. 4.00 sep. 14, 2005 page 152 of 982 rej09b0023-0400 4.6 notes on board design note on using an external crystal resonator: place the crystal resonator, capacitors cl1 and cl2, and feedback resistor r1 as close to the xtal and extal pins as possible. in addition, to minimize induction and thus obtain oscillation at the correct frequency, the capacitors to be attached to the resonator must be grounded to the same ground. do not bring wiring patterns close to these components. signal lines prohibited cl1 cl2 extal xtal this lsi rl the values for cl1, cl2, and the damping resistance ri should be determined after consultation with the crystal resonator manufacturer. note: reference value cl1 = 10 to 33 pf cl2 = 10 to 33 pf rl = 1m? figure 4.2 note on using a crystal resonator notes on using external clocks: when external clocks are input from the extal pin, leave the xtal pin open. in order to prevent a malfunction due to the reflection noise caused in a signal line which connected to xtal pin, cut this signal line as short as possible. notes on bypass capacitor: a multilayer ceramic capacitor must be inserted for each pair of vss and vcc as a bypass capacitor. the bypass capacito r must be inserted as close as possible to the power supply pins of the lsi. note that th e capacitance and frequency characteristics of the bypass capacitor must be appropriate fo r the operating frequency of the lsi. ? a pair of vss and vcc for the input/output power supply c1 to d1, m4 to m3, v1 to w1, u7 to v7, u1 2 to v12, y18 to y19, m19 to m18, h17 to h18, c20 to b20, a18 to a17, d14 to c14, d13 to c13, d8 to c8, a3 to a2 ? a pair of vss and vcc for the digital modules f3 to f4, k3 to k4, u4 to t4, v6 to u6, v10 to u10, u17 to u16, r18 to r17, l18 to l17, d17 to e17, c15 to d15, c11 to d11, d4 to d5 ? a pair of vss and vcc for the on-chip oscillator k20 to k17, k18 to j20
section 4 clock pulse generator (cpg) rev. 4.00 sep. 14, 2005 page 153 of 982 rej09b0023-0400 ? a pair of vss and vcc for the input/output power supply nearest the usb module h3 to h4 ? a pair of vss and vcc for the a/d converter. w19 to u20 notes on using a pll oscillator circuit: in the vcc and vss connection pattern for the pll, signal lines from the board power supply pins must be as short as possible and pattern width must be as wide as possible to reduce inductive interference. in clock operating mode 7, the extal pin is pulled up and the xtal pin is left open. since the analog power supply pins of the pll are sensitive to the noise, the system may malfunction due to inductive interference at the other power supply pins. to prevent such malfunction, the analog power supply pin vcc and digital power supply pin vccq should not supply the same resources on th e board if at all possible. vcc(pll2) vss(pll2) vcc(pll1) vss(pll1) vcc vss power supply signal lines prohibited figure 4.3 note on usin g a pll oscillator circuit
section 4 clock pulse generator (cpg) rev. 4.00 sep. 14, 2005 page 154 of 982 rej09b0023-0400
section 5 watchdog timer (wdt) rev. 4.00 sep. 14, 2005 page 155 of 982 rej09b0023-0400 section 5 watchdog timer (wdt) this lsi includes the watchdog timer (wdt), wh ich enables reset the lsi on overflow of the counter when the value of the counter has not been updated because of a system malfunction. the wdt is a single channel timer that counts up the clock-settling period when the system leaves standby mode or the temporary periods on standby that occur when the clock frequency is changed. it can also be used as a watchdog timer or interval timer. 5.1 features the wdt has the following features: ? can be used to ensure the clock settling time: the wdt is used in leaving standby mode or the temporary periods on standby that occur when the clock frequency is changed. ? can switch between watchdog timer mode and interval timer mode. ? generates internal resets in watchdog timer mode: internal resets occur after counter overflow. power-on reset or manual reset can be selected as a reset. ? interrupt generation in interval timer mode an interval timer interrupt is generated when the counter overflows. ? choice of eight counter input clocks eight clocks ( 1 to 1/4096) that are obtained by dividing the peripheral clock can be selected.
section 5 watchdog timer (wdt) rev. 4.00 sep. 14, 2005 page 156 of 982 rej09b0023-0400 figure 5.1 shows a block diagram of the wdt. wtcsr standby control bus interface wtcnt divider clock selector clock standby mode peripheral clock standby cancellation reset control clock selection wdt overflow internal reset request interrupt control interrupt request [legend] wtcsr: wtcnt: watchdog timer control/status register watchdog timer counter figure 5.1 block diagram of the wdt 5.2 register descriptions the wdt has the following two regi sters. see section 24, list of registers, for the addresses and access sizes of these registers. ? watchdog timer counter (wtcnt) ? watchdog timer control/status register (wtcsr) 5.2.1 watchdog timer counter (wtcnt) the watchdog timer counter (wtcnt) is an 8-bit read able/writable register that is incremented by cycles of the selected clock signal. when an overflow occurs, it generates a reset in watchdog timer mode and an interrupt in interval timer mode. the wtcnt counter is initialized to h'00 only by a power-on reset caused by the resetp pin. use a word access to write to the wtcnt counter, writing h'5a in the upper byte . use a byte access to read the wtcnt. note: the wtcnt differs from other registers in the prevention of erroneous writes. see section 5.2.3, notes on register access, for details.
section 5 watchdog timer (wdt) rev. 4.00 sep. 14, 2005 page 157 of 982 rej09b0023-0400 5.2.2 watchdog timer control/status register (wtcsr) the watchdog timer control/status register (wtcsr) is an 8-bit readable/writable register composed of bits to select the cl ock used for the count, overflow flags, and timer enable bit. the wtcsr register holds its value in an internal reset due to wdt overflow. the wtcsr register is initialized to h'00 only by a power-on reset caused by the resetp pin. when used to count the clock settling time for canceling a standby, it retains its value after counter overflow. use a word access to write to the wtcsr counter, writing h'a5 in the upper byte. use a byte access to read the wtcsr. note: the wtcnt differs from other registers in the prevention of erroneous writes. see section 5.2.3, notes on register access, for details. bit bit name initial value r/w description 7 tme 0 r/w timer enable starts and stops timer operation. clear this bit to 0 when using the wdt in standby mode or when changing the clock frequency. 0: timer disabled: count-up stops and wtcnt value is retained 1: timer enabled 6 wt/ it 0 r/w timer mode select selects whether to use the wdt as a watchdog timer or an interval timer. 0: use as interval timer 1: use as watchdog timer note: if wt/ it is modified when the wdt is running, the up-count may not be performed correctly. 5 rsts 0 r/w reset select selects the type of reset when the wtcnt overflows in watchdog timer mode. in interval timer mode, this setting is ignored. 0: power-on reset 1: manual reset
section 5 watchdog timer (wdt) rev. 4.00 sep. 14, 2005 page 158 of 982 rej09b0023-0400 bit bit name initial value r/w description 4 wovf 0 r/w watchdog timer overflow indicates that the wtcnt has overflowed in watchdog timer mode. this bit is not set in interval timer mode. 0: no overflow 1: wtcnt has overflowed in watchdog timer mode 3 iovf 0 r/w interval timer overflow indicates that the wtcnt has overflowed in interval timer mode. this bit is not set in watchdog timer mode. 0: no overflow 1: wtcnt has overflowed in interval timer mode 2 1 0 cks2 cks1 cks0 0 0 0 r/w r/w r/w clock select these bits select the clock to be used for the wtcnt count from the eight types obtainable by dividing the peripheral clock (p ). the overflow period that is shown inside the parenthesis in the table is the value when the peripheral clock (p ) is 15 mhz. bits 2 to 0 clock ratio overflow cycle 000: 1 17 us 001: 1/4 68 us 010: 1/16 273 us 011: 1/32 546 us 100: 1/64 1.09 ms 101: 1/256 4.36 ms 110: 1/1024 17.48 ms 111: 1/4096 69.91 ms note: if bits cks2 to cks0 are modified when the wdt is running, the up-count may not be performed correctly. ensure that these bits are modified only when the wdt is not running. in addition, the timing of the first overflow includes deviation. see section 5.4, precautions to take when using the wdt.
section 5 watchdog timer (wdt) rev. 4.00 sep. 14, 2005 page 159 of 982 rej09b0023-0400 5.2.3 notes on register access the watchdog timer counter (wtcnt) and watchdog timer control/status register (wtcsr) are more difficult to write to than other registers. the procedures for reading or writing to these registers are given below. writing to wtcnt and wtcsr: these registers must be written by a word transfer instruction. they cannot be written by a byte or longword transfer instruction. when writing to wtcnt, set the upper byte to h'5a and transfer the lower byte as the write data, as shown in figure 5.2. when writing to wtcsr, set the upper byte to h'a5 and transfer the lower byte as the write data. this transfer procedure writes the lower byte data to wtcnt or wtcsr. 15 8 7 0 h'5a write data address: h'a415ff84 wtcnt write 15 8 7 0 h'a5 write data address: h'a415ff86 wtcsr write figure 5.2 writing to wtcnt and wtcsr 5.3 use of the wdt 5.3.1 canceling standbys the wdt can be used to cancel st andby mode with an interrupt such as an nmi interrupt. the procedure is described below. (the wdt does not operate when resets are used for canceling, so keep the resetp or resetm pin low until the clock stabilizes.) 1. before transitioning to standby mode, always clear the tme bit in wtcsr to 0. when the tme bit is 1, an erroneous reset or interval timer interrupt may be generated when the count overflows. 2. set the type of count clock used in the cks2 to cks0 bits in wtcsr and the initial values for the counter in the wtcnt. these values should ensure that the time till count overflow is longer than the clock oscillation settling time. 3. the execution of a sleep instruction after the stby bit of the st andby control register (stbcr: see section 6, power-down modes) puts the system in standby mode and clock operation then stops. 4. the wdt starts counting by detecti ng the edge change of the nmi signal.
section 5 watchdog timer (wdt) rev. 4.00 sep. 14, 2005 page 160 of 982 rej09b0023-0400 5. when the wdt count overflows, the cpg st arts supplying the clock and the processor resumes operation. the wovf flag in wtcsr is not set when this happens. 6. since the wdt continues counting from h'00, set the stby bit in the stbcr register to 0 in the interrupt processing program and this will stop the wdt. when the stby bit remains 1, the lsi again enters the standby mode when the wdt has counted up to h'80. this standby mode can be canceled by power-on resets. 5.3.2 changing the frequency to change the frequency used by the pll, use the wdt. when changing the frequency only by switching the divider, do not use the wdt. 1. before changing the frequenc y, always clear the tme bit in wtcsr to 0. when the tme bit is 1, an erroneous reset or interval timer interrupt may be generated when the count overflows. 2. set the type of count clock used in the cks2 to cks0 bits of wtcsr and the initial values for the counter in the wtcnt counter. these values should ensure that the time till count overflow is longer than the clock oscillation settling time. 3. when the frequency control register (frqcr) is written, the processor stops temporarily. the wdt starts counting. 4. when the wdt count overflows, the cpg re sumes supplying the cl ock and the processor resumes operation. the wovf in wtcs r is not set when this happens. 5. the counter stops at the values h'00. 6. before changing the wtcnt after the executi on of the frequency change instruction, always confirm that the value of the wtcn t is h'00 by reading the wtcnt. 5.3.3 using watchdog timer mode 1. set the wt/ it bit in the wtcsr to 1, set the reset type in the rsts bit, set the type of count clock in the cks2 to cks0 bits, and set the initial value of the counter in the wtcnt. 2. set the tme bit in wtcsr to 1 to start the count in watchdog timer mode. 3. while operating in watchdog timer mode, rewrit e the counter periodically to h'00 to prevent the counter from overflowing. 4. when the counter overflows, the wdt sets th e wovf flag in wtcsr to 1 and generates the type of reset specified by the rsts bit. the counter then resumes counting.
section 5 watchdog timer (wdt) rev. 4.00 sep. 14, 2005 page 161 of 982 rej09b0023-0400 5.3.4 using interval timer mode when operating in interval timer mode, interval tim er interrupts are generated at every overflow of the counter. this enables interrupts to be generated at set periods. 1. clear the wt/ it bit in the wtcsr to 0, set the type of count clock in the cks2 to cks0 bits, and set the initial value of the counter in the wtcnt. 2. set the tme bit in wtcsr to 1 to start the count in interval timer mode. 3. when the counter overflows, the wdt sets th e iovf in wtcsr to 1 and an interval timer interrupt request is sent to intc. the counter then resumes counting. 5.4 precautions to take when using the wdt pay attention to the following points when using the wdt in either the interval timer or watchdog timer mode. 1. timer tolerance after timer operation has started, the period from the power-on reset point to the first count up timing of the wtcnt varies depending on the time period that is set by the tme bit of the wtcsr register. the shortest such time period is thus one cycle of the peripheral clock, p , while the longest is the result of frequency di vision according to the va lue in cks2 to cks0. the timing of subsequent incrementation is in accord with the selected frequency divisor. this time difference is referred to as timer variation. this also applies to the timing of the first incrementation after the wtcnt register has been written to during timer operation. 2. do not set wtcnt to h'ff when the value in wtcnt reaches h'ff, the wdt assumes that an overflow has occurred. accordingly, when h'ff is placed in wtcnt, an interval timer interrupt or wdt reset will occur immediately, regardless of the current clock selection by bits cks2 to cks0.
section 5 watchdog timer (wdt) rev. 4.00 sep. 14, 2005 page 162 of 982 rej09b0023-0400
section 6 power-down modes rev. 4.00 sep. 14, 2005 page 163 of 982 rej09b0023-0400 section 6 power-down modes in the low power-consumption modes, operation of some of the internal peripheral modules and of the cpu stops. this leads to reduced power consum ption. these modes are canceled by a reset or interrupt. 6.1 features 6.1.1 power-down modes this lsi has the following power-down modes and function: 1. sleep mode 2. standby mode 3. module standby function table 6.1 shows the transition conditions for entering the modes from the program execution state, as well as the cpu and peripheral module states in each mode and the pr ocedures for canceling each mode.
section 6 power-down modes rev. 4.00 sep. 14, 2005 page 164 of 982 rej09b0023-0400 table 6.1 states of power-down modes state * mode transition c onditions cpg cpu cpu register on-chip memory on-chip peripheral modules external memory canceling procedure sleep mode execute sleep instruction with stby bit cleared to 0 in stbcr runs halts held halts (the contents are retained.) the ubc stops. other modules continue to run. refreshed automati-cally 1. interrupt 2. reset standby mode execute sleep instruction with stby bit set to 1 in stbcr halts halts held halts (the contents are retained.) halt self-refreshed 1. interrupt 2. reset module standby function set the mstp bits in stbcr, stbcr2, stbcr3, and stbcr4 to 1 (with the exception of the mstp bits for the usb module; clear these bits). runs runs held the specified module stops (the contents are retained). specified module halts refreshed automati-cally 1. clear mstp bit to 0. (with the exception of the mstp bits for the usb module; set these bits). 2. power-on reset note: * the pin state is retained or set to high impedance. for details, see appendix a, pin states. 6.1.2 reset a reset is used at power-on or to re-execute from the initial state. this lsi supports two types of reset: power-on reset and manual reset. in power-on reset, any processing to be currently executed is terminated and any events not executed are cancel ed to execute reset pro cessing immediately. in manual reset, processing required to maintain external memory contents is continued. the following shows the conditions in which power-on reset or manual reset occurs. ? power-on reset 1. a low level signal is input to the resetp pin. 2. the wdt counter overflows if wdt starts counting while the wt/ it and rsts bits of the wtcsr are set to 1 and cleared to 0, respectively. 3. an h-udi reset occurs. (for details on h-udi reset, refer to section 15, user debugging interface (h-udi).)
section 6 power-down modes rev. 4.00 sep. 14, 2005 page 165 of 982 rej09b0023-0400 ? manual-on reset 1. a low signal is input to the resetm pin. 2. the wdt counter overflows if wdt starts counting while the wt/ it and rsts bits of the wtcsr are set to 1. 6.1.3 input/output pins table 6.2 lists the pins used for the power-down modes. table 6.2 pin configuration pin name symbol i/o description processing state 1 status1 processing state 0 status0 output indicates the operat ional state of this lsi. hh: manual reset hl: sleep mode lh: standby mode ll: normal operation power-on reset resetp input inputting low leve l signal to this pin cause a transition to power-on reset processing. manual reset resetm input inputting low leve l signal to this pin cause a transition to manual reset processing. note: h and l indicate high and low levels, res pectively. status1 and status0 indicate the pin status in this order. to use this pin as the status pin, a pfc setting is required. for details on this, see section 22, pin function controller (pfc).
section 6 power-down modes rev. 4.00 sep. 14, 2005 page 166 of 982 rej09b0023-0400 6.2 register descriptions the following registers are used in the low power-consumption modes. for the addresses and access sizes of these registers, see section 24, list of registers. ? standby control register (stbcr) ? standby control register 2 (stbcr2) ? standby control register 3 (stbcr3) ? standby control register 4 (stbcr4) 6.2.1 standby control register (stbcr) the standby control register (stbcr) is an 8-bit re adable/writable register that specifies the state of the power-down mode. this register is initialized (to h'00) by a power-on reset but retains its previous value after a manual reset or a period in the standby mode. only byte access is valid. bit bit name initial value r/w description 7 stby 0 r/w software standby specifies transition to software standby mode. 0: executing sleep instruct ion puts chip into sleep mode. 1: executing sleep instru ction puts chip into software standby mode. 6 to 0 ? all 0 r reserved these bits are always read as 0. the write value should always be 0.
section 6 power-down modes rev. 4.00 sep. 14, 2005 page 167 of 982 rej09b0023-0400 6.2.2 standby control register 2 (stbcr2) the standby control register 2 (stbcr2) is a read able/writable 8-bit register that controls the operation of modules in the power-down mode. stbcr2 is initialized (to h'00) by a power-on reset but retains its previous value after a manual reset or a period in the standby mode. only byte access is valid. bit bit name initial value r/w description 7 mstp10 0 r/w module stop 10 when the mstp10 bit is set to 1, the supply of the clock to the h-udi is halted. 0: h-udi runs. 1: clock supply to h-udi halted. 6 mstp9 0 r/w module stop 9 when the mstp9 bit is set to 1, the supply of the clock to the ubc is halted. 0: ubc runs. 1: clock supply to ubc halted. 5 mstp8 0 r/w module stop 8 when the mstp8 bit is set to 1, the supply of the clock to the dmac is halted. 0: dmac runs. 1: clock supply to dmac halted. 4 mstp7 0 r/w module stop 7 when the mstp7 bit is set to 1, the supply of the clock to the dsp is halted. 0: dsp runs. 1: clock supply to dsp halted. 3 ? 0 r reserved this bit is always read as 0. the write value should always be 0.
section 6 power-down modes rev. 4.00 sep. 14, 2005 page 168 of 982 rej09b0023-0400 bit bit name initial value r/w description 2 mstp5 0 r/w module stop 5 when the mstp5 bit is set to 1, the supply of the clock to the cache memory is halted. 0: the cache memory runs. 1: clock supply to the cache memory halted. 1 mstp4 0 r/w module stop 4 when the mstp4 bit is set to 1, the supply of the clock to the u memory is halted. 0: the u memory runs. 1: clock supply to the u memory halted. 0 mstp3 0 r/w module stop 3 when the mstp3 bit is set to 1, the supply of the clock to the x/y memory is halted. 0: the x/y memory runs. 1: clock supply to the x/y memory halted. 6.2.3 standby control register 3 (stbcr3) stbcr3 is a readable/writable 8-bit register used to select whether or not individual modules operate in power-down mode. stbcr3 is initialized (to h'00) by a power-on reset, but retains its previous value after a manual reset or a period in the standby mode. only byte access is valid. bit bit name initial value r/w description 7 hiz 0 r/w port high impedance this bit selects whether the state of a specified pin is retained or the pin is placed in the high-impedance state. see appendix a, pi n states to determine the pin to which this control is applied. do not set this bit when the tme bit of wtscr of the wdt is 1. when setting the output pin to the high- impedance state, set the hiz bit with the tme bit being 0. 0: the pin state is held in standby mode. 1: the pin state is set to the high-impedance state in standby mode.
section 6 power-down modes rev. 4.00 sep. 14, 2005 page 169 of 982 rej09b0023-0400 bit bit name initial value r/w description 6 ? 0 r/w reserved this bit is always read as 0. the write value should always be 0. 5 mstp35 0 r/w module stop 35 when the mstp35 bit is set to 1, supply of the clock to the cmt0 stops. 0: the cmt0 runs. 1: supply of the clock to the gmt0 stops. 4 ? 0 r reserved this bit is always read as 0. the write value should always be 0. 3 mstp33 0 r/w module stop 33 when the mstp33 bit is set to 1, supply of the clock to the adc stops. 0: the adc runs. 1: supply of the clock to the adc stops. 2 mstp32 0 r/w module stop 32 when the mstp32 bit is set to 1, supply of the clock to the scif2 stops. 0: the scif2 runs. 1: supply of the clock to the scif2 stops. 1 mstp31 0 r/w module stop 31 when the mstp31 bit is set to 1, supply of the clock to the scif1 stops. 0: the scif1 runs. 1: supply of the clock to the scif1 stops. 0 mstp30 0 r/w module stop 30 when the mstp30 bit is set to 1, supply of the clock to the scif0 stops. 0: the scif0 runs. 1: supply of the clock to the scif0 stops.
section 6 power-down modes rev. 4.00 sep. 14, 2005 page 170 of 982 rej09b0023-0400 6.2.4 standby control register 4 (stbcr4) stbcr4 is a readable/writable 8-bit register used to select whether or not individual modules operate in power-down mode. stbcr4 is initialized (to h'00) by a power-on reset, but retains its previous value after a manual reset or a period in the standby mode. only byte access is valid. bit bit name initial value r/w description 7 ? 0 r reserved this bit is always read as 0. the write value should always be 0. 6 mstp46 0 r/w module stop 46 0: the usb module stops. 1: supply of the clock to the usb is started. 5 mstp45 0 r/w module stop 45 when the mstp45 bit is set to 1, supply of the clock to the mtu stops. 0: the mtu runs. 1: supply of the clock to the mtu stops. 4 mstp44 0 r/w module stop 44 when the mstp44 bit is set to 1, supply of the clock to the poe stops. 0: the poe runs. 1: supply of the clock to the poe stops. 3 mstp43 0 r/w module stop 43 when the mstp43 bit is set to 1, supply of the clock to the cmt1 stops. 0: the cmt1 runs. 1: supply of the clock to the cmt1 stops. 2 mstp42 0 r/w module stop 42 when the mstp42 bit is set to 1, supply of the clock to the iic2 stops. 0: the iic2 runs. 1: supply of the clock to the iic2 stops. 1, 0 ? all 0 r reserved these bits are always read as 0. the write value should always be 0.
section 6 power-down modes rev. 4.00 sep. 14, 2005 page 171 of 982 rej09b0023-0400 6.3 operation 6.3.1 sleep mode 1. transition to sleep mode executing the sleep inst ruction when the stby bit in st bcr is 0 causes a transition from the program execution state to sleep mode. although the cpu halts immediately after executing the sleep instruction, the contents of its internal registers remain unchanged. the on-chip modules continue to run in sleep mode , but the on-chip memory is not accessible. if the on-chip memory is accessed by, for exampl e, the dmac, the access is ignored and the value read is not defined. clock pulses continue to be output on the ckio and ckio2 pins. in sleep mode, a high signal and low signal are output from the status1 and status0 pins, respectively. 2. canceling sleep mode sleep mode is canceled by an interrupt ( nmi , irq , and on-chip peripheral module) or reset. interrupts are accepted in sleep mode even when the bl bit in the sr register is 1. if necessary, save spc and ssr to the stack before executing the sleep instruction. ? canceling with an interrupt when an nmi , irq , or on-chip peripheral module interrupt occurs, sleep mode is canceled and interrupt exception handling is executed. a code indicating the interrupt source is set in the intevt2 registers. ? canceling with a reset sleep mode is canceled by a powe r-on reset or a manual reset.
section 6 power-down modes rev. 4.00 sep. 14, 2005 page 172 of 982 rej09b0023-0400 6.3.2 standby mode 1. transition to standby mode the lsi switches from a program execution state to a standby mode by executing the sleep instruction when the stby bit is 1 in stbcr register. in standby mode, not only the cpu but also the clock and on-chip peripheral modules halt. the clock outputs from the ckio and ckio2 pins also halt. the contents of the cpu and cache registers remain unchanged. some registers of on-chip peripheral modules are, however, initialized. table 6.3 lists the states of on-chip peripheral modules registers in standby mode. table 6.3 register states in standby mode module registers initialized registers retaining data interrupt controller (intc) ? all registers on-chip clock pulse generator (cpg) ? all registers user break controller (ubc) ? all registers bus state controller (bsc) ? all registers a/d converter (adc) all registers ? i/o port ? all registers h-udi ? all registers scif ? all registers usb ? all registers mtu all registers ? poe ? all registers dmac ? all registers cmt ? all registers iic2 ? all registers the procedure for switching to standby mode is as follows: a. clear the tme bit in the wdt's timer contro l register (wtcsr) to 0 to stop the wdt. b. set the wdt's timer counter (wtcnt) to 0 and the cks2 to cks0 bits in the wtcsr register to appropriate values to secure the specified oscill ation settling time. c. after the stby bit in the stbcr register is set to 1, a sleep instruction is executed. d. standby mode is entered and the clocks within the chip are halted. the status1 and status0 pins output low and high, respectively.
section 6 power-down modes rev. 4.00 sep. 14, 2005 page 173 of 982 rej09b0023-0400 2. canceling standby mode standby mode is cancel ed by interrupts ( nmi , irq ) or a reset. ? canceling with an interrupt the on-chip wdt can be used for hot starts. when an interrupt request is detected at the rising or falling edge of nmi or irq , the clock will be supplied to the entire chip and standby mode canceled after the time set in the wdt's timer control/status register has elapsed. the status1 and status0 pins go low. interrupt handling then begins and a code indicating the interrupt source is set in the intevt2 regist ers. after the branch to the interrupt handling routine, clear the stby bit in the stbcr regist er. wdt stops automatically. if the stby bit is not cleared, wdt continues operation and a transition is made to standby mode* when the wtcnt reaches h'80. a manual reset will not be accepted while the stby bit is set. interrupts are accepted in standby mode even when the bl bit in the sr register is 1. if necessary, save spc and ssr to the stack before executing the sleep instruction. immediately after an interrupt is detected and until the system is taken out of standby mode, the phase of the clock outputs from the ckio and ckio2 pins may be unstable. notes: * this standby mode can be canceled only by a power-on reset. wtcnt value h'ff h'80 time interrupt request wdt overflow and branch to interrupt handling routine crystal oscillator settling time and pll synchronization time clear bit stbcr.stby before wtcnt reaches h'80. when stbcr. stby is cleared, wtcnt halts automatically. figure 6.1 canceling standby mode with stbcr.stby ? canceling with a reset standby mode is canceled by a reset using the resetp or resetm pin. keep the resetp or resetm pin low until the clock oscillation settles. the internal clock will continue to be output to the ckio pin.
section 6 power-down modes rev. 4.00 sep. 14, 2005 page 174 of 982 rej09b0023-0400 6.3.3 module standby function 1. transition to module standby function setting the standby control register mstp bits to 1 halts the supply of clocks to the corresponding on-chip peripheral modules (however, the initial state of the usb stops). this function can be used to reduce the power consumption in normal mode and sleep mode. disable a module before placing it in the modul e standby mode. in addition, do not access the module's registers while it is in the module-standby state. in module standby state, the functions of the external pins of the on-chip peripheral modules change depending on the on-chip peripheral module. for details on this, see appendix a, pin states. the states of the registers are the sa me as in the standby mode. see table 6.3. 2. canceling module standby function the module standby function except usb can be ca nceled by clearing the mstp bits to 0, or by a power-on reset. in the case of the usb module, setting the corresponding mstp bit to 1 cancels the module standby state. when taking a module out of the module standby state by clearing the corresponding bit to 0 (or setting it to 1 in the case of the usb module), read the bit to confirm that it has been cleared to 0 (or set to 1 in the usb case). 6.3.4 status pin change timings to use these pins as the status1 and status0 pins, the corresponding setting must be made in the pfc. for details on setting of the pfc, see section 22, pin function controller (pfc). a power-on reset initializes the pfc setting; the default value selects operation as ptc15 and ptc14 port-input pins. accordingly, when you wish to use these pins for the status function immediately after a power-on reset, take the following steps. this also applies to power-on resets from the wdt and resets from the h-udi. 1. pull up the status1 and status0 pins. 2. change the pfc setting made by power-on reset processing so that the status function is selected for these pins. both status1 and status0 become high during a power-on reset and are low on completion of power-on reset processing. the state of the lsi is thus indicated. the timing of the level changes of the status1 and status0 pins is shown below.
section 6 power-down modes rev. 4.00 sep. 14, 2005 page 175 of 982 rej09b0023-0400 1. manual reset ckio status 1. in manual reset, status = hh (reset) after the current bus cycle is completed and then internal reset is initiated. 2. reset: hh (status1 = high, status0 = high) 3. normal: ll (status1 = low, status0 = low) 4. bcyc: bus clock cycle notes * 3 * 3 * 2 0 to 30 bcyc * 4 0 bcyc to normal reset normal * 1, * 4 resetm figure 6.2 status output at manual reset 2. standby mode a standby mode is cancel ed by an interrupt ckio status wdt count interrupt request oscillation stops wdt overflow 1. standby : lh (status1 = low, status0 = high) 2. normal : ll (status1 = low, status0 = low) notes: * 2 * 2 * 1 normal standby normal figure 6.3 status output when standby mode is canceled by an interrupt
section 6 power-down modes rev. 4.00 sep. 14, 2005 page 176 of 982 rej09b0023-0400 b standby mode is cancel ed by a manual reset ckio status 1. 2. 3. 4. 5. if a standby mode is canceled by a manual reset, the wdt stops counting. resetm must be kept low for the pll oscillation stabilization time. reset : hh (status1 = high, status0 = high) standby : lh (status1 = low, status0 = high) normal : ll (status1 = low, status0 = low) bcyc : bus clock cycle oscillation stops reset notes: * 2 * 4 * 3 normal standby reset * 1 0 to 20 bcyc * 5 * 4 normal resetm figure 6.4 status output when software st andby mode is canceled by a manual reset 3. sleep mode a sleep mode is cancel ed by an interrupt ckio status 1. sleep : hl (status1 = high, status0 = low) 2. normal : ll (status1 = low, status0 = low) notes: * 2 * 2 * 1 normal sleep normal interrupt request figure 6.5 status output when sleep mode is canceled by an interrupt
section 6 power-down modes rev. 4.00 sep. 14, 2005 page 177 of 982 rej09b0023-0400 b sleep standby mode is canceled by a manual reset ckio status 1. resetm must be kept low until status = reset. 2. reset:hh (status1 = high, status0 = high) 3. sleep:hl(ststus1= high, status0= low) 4. normal:ll (status1 = low, status0 = low) 5. bcyc:bus clock cycle notes: * 4 * 4 * 1 * 2 0 to 30 bcyc * 5 0 to 80 bcyc normal * 3 sleep reset normal * 5 reset resetm figure 6.6 status output when sleep mode is canceled by a manual reset
section 6 power-down modes rev. 4.00 sep. 14, 2005 page 178 of 982 rej09b0023-0400
section 7 cache rev. 4.00 sep. 14, 2005 page 179 of 982 rej09b0023-0400 section 7 cache 7.1 features the cache specifications are listed in table 7.1. table 7.1 cache specifications parameter specification capacity 16 kbytes structure instructions/data mi xed, 4-way set associative locking way 2 and way 3 are lockable line size 16 bytes number of entries 256 entries/way write system p0, p1, p3: write- back/write-through selectable replacement method least-recently-used (lru) algorithm in this lsi, the address space is partitioned into five subdivis ions, and the cache access method is determined by the address. table 7.2 shows the kind of cache access available in each address space subdivision. table 7.2 address space subdivisions and cache operation address bits a31 to 29 address space subdivision cache operation 0xx p0 write-back/write-through selectable 100 p1 write-back/write-through selectable 101 p2 non-cacheable 110 p3 write-back/write-through selectable 111 p4 i/o area, non-cacheable note that area p4 is an i/o area, to which the addresses of on-chip regist ers, etc., are allocated. to ensure data consistency, the cache stores 32-bit addresses with the upper 3 bits masked to 0.
section 7 cache rev. 4.00 sep. 14, 2005 page 180 of 982 rej09b0023-0400 7.1.1 cache structure the cache mixes data and instructions and uses a 4-way set associative system. it is composed of four ways (banks), each of which is divided into an address section and a data section. each of the address and data sections is divided into 256 entries. the data section of the entry is called a line. each line consists of 16 bytes (4 bytes 4). the data capacity per way is 4 kbytes (16 bytes 256 entries), with a total of 16 kbytes in the cache as a whole (4 ways). figure 7.1 shows the cache structure. 24 (1 + 1 + 22) bits 128 (32 4) bits 6 bits lw0 to lw3: longword data 0 to 3 entry 0 entry 1 entry 255 0 1 255 0 1 255 v u tag address lw0 lw1 lw2 lw3 address array (ways 0 to 3) data array (ways 0 to 3) lru . . . . . . . . . . . . . . . . . . figure 7.1 cache structure address array: the v bit indicates whether the entry data is valid. when the v bit is 1, data is valid; when 0, data is not valid. the u bit indicates whether the entry has been written to in write- back mode. when the u bit is 1, the entry has been written to; when 0, it has not. the address tag holds the physical address used in the external me mory access. it is composed of 22 bits (address bits 31 to 10) used for comparison during cache searches. in this lsi, the top three of 32 physical address bits are used as shadow bits (see section 12, bus state controller (bsc)), and theref ore the top three bits of the tag address are cleared to 0. the v and u bits are initialized to 0 by a power-on reset and retain the previous value by a manual reset, standby mode, module standby mode, and sleep mode. the tag address is not initialized by a power-on or manual reset, standby mode, module standby mode, and sleep mode.
section 7 cache rev. 4.00 sep. 14, 2005 page 181 of 982 rej09b0023-0400 data array: holds a 16-byte instruction or data. entries are registered in the cache in line units (16 bytes). the data array is not initialized by a power-on or manual reset, standby mode, module standby mode, and sleep mode. lru: with the 4-way set associative system, up to fo ur instructions or data with the same entry address (address bits 11 to 4) can be registered in the cache. when an entry is registered, lru shows which of the four ways it is recorded in. there are six lru bits, controlled by hardware. a least-recently-used (lru) algorithm is used to select the way that has been least recently accessed. six lru bits indicate the way to be replaced in case of a cache miss. the relationship between lru and way replacement is shown is table 7.3 when the cache lock function is not used 1 concerning the case where the cache lock function is used, see section 7.2.2, cache control register 2 (ccr2). if a bit pattern other than those listed in table 7.3 is set in the lru bits by software, the cache will not function correctly. when modifying the lru bits by software, set one of the patterns listed in table 7.3. the lru bits are initialized to 000000 by a powe r-on reset and retaining the previous value by a manual reset, standby mode, module standby mode, and sleep mode. table 7.3 lru and way replacement lru (bits 5 to 0) way to be replaced 000000, 000100, 010100, 100000, 110000, 110100 3 000001, 000011, 001011, 100001, 101001, 101011 2 000110, 000111, 001111, 010110, 011110, 011111 1 111000, 111001, 111011, 111100, 111110, 111111 0
section 7 cache rev. 4.00 sep. 14, 2005 page 182 of 982 rej09b0023-0400 7.2 register descriptions the cache has the following registers. ? cache control register 1 (ccr1) ? cache control register 2 (ccr2) 7.2.1 cache control register 1 (ccr1) the cache is enabled or disabled using the ce bit in ccr1. ccr1 also has the cf bit (which invalidates all cache entries), and the wt and wb bi ts (which select either write-through mode or write-back mode). programs that change the contents of ccr1 should be placed in an address space that is not cached. when updating the contents of ccr1, bits 31 to 4 must always be cleared to 0. ccr1 is initialized to h'00000000 by a power-on or manual reset and retain the previous value by standby mode, module standby mode, and sleep mode. bit bit name initial value r/w description 31 to 4 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 3 cf 0 r/w cache flush writing 1 flushes all cache entries (clears the v, u, and lru bits of all cache entries to 0). always reads 0. write-back to external memory is not performed when the cache is flushed. 2 wb 0 r/w write back switches write-back/wr ite-through the cache's operating mode for area p1. 0: write-through mode 1: write-back mode 1 wt 0 r/w write through indicates the cache's operating mode for areas p0 and p3. 0: write-back mode 1: write-through mode
section 7 cache rev. 4.00 sep. 14, 2005 page 183 of 982 rej09b0023-0400 bit bit name initial value r/w description 0 ce 0 r/w cache enable indicates whether the cache function is used. 0: cache not used 1: cache used 7.2.2 cache control register 2 (ccr2) ccr2 is used to enable or disable the cache locking function and is valid in cache locking mode only. in cache locking mode, the dsp bit (bit 12) in the status register (sr) of the cpu is set to 1. alternatively, the lock enable bit (bit 16) in ccr2 is set to 1. in the non-cache-locking mode, the cache locking function is invalid. when a cache miss occurs in cache locking mode by executing the prefet ch instruction (pref @rn), the line of data pointed to by rn is load ed into the cache according to bits 9 and 8 (the w3load and w3lock bits) and bits 1 and 0 (the w2load and w2lock bits) in ccr2. the relationship between the setting of each bit and a wa y, to be replaced when the prefetch instruction is executed, are listed in table 7.4. on the other hand, when the prefetch instruction is executed and a cache hit occurs, new data is not fetched and the entry which is already enabled is held. for example, when the prefetch instruction is executed with w3load = 1 and w3lock = 1 specified in cache locking mode while one-line data already exists in way 0 which is specified by rn, a cache hit occurs and data is not fetched to way 3. in the cache access other than the prefetch instruction in cache locking mode, ways to be replaced by bits w3lock and w2lock are restricted. the relationship between the setting of each bit in ccr2 and ways to be replaced are listed in table 7.5. the program that change the contents of ccr2 sh ould be placed in an a ddress space that is not cached. ccr2 is initialized to h'00000000 by a power-on or manual reset and retain the previous value by standby mode, module standby mode, and sleep mode.
section 7 cache rev. 4.00 sep. 14, 2005 page 184 of 982 rej09b0023-0400 bit bit name initial value r/w description 31 to 17 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 16 le 0 r/w lock enable this bit enables or disables the cache locking function. 0: cache locking mode is entered when sr.dsp=1 1: cache locking mode is entered regardless of the value of sr.dsp 15 to 10 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 9 8 w3load w3lock 0 0 r/w r/w way 3 load way 3 lock when a cache miss occurs by the prefetch instruction while w3load = 1 and w3lock = 1 in cache locking mode, the data is always loaded into way 3. under any other condition, the prefetch ed data is loaded into the way to which lru points. 7 to 2 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 1 0 w2load w2lock 0 0 r/w r/w way 2 load way 2 lock when a cache miss occurs by the prefetch instruction while w2load = 1 and w2lock in cache locking mode, the data is always loaded into way 2. under any other condition, the prefetch ed data is loaded into the way to which lru points. note: the w2load and w3load bits should not be set to 1 at the same time.
section 7 cache rev. 4.00 sep. 14, 2005 page 185 of 982 rej09b0023-0400 table 7.4 way to be replaced when a cache miss occurs in pref instruction cache locking mode bit w3load w3lock w2load w2lock way to be replaced 0 * * * * decided by lru (table 7.3) 1 * 0 * 0 decided by lru (table 7.3) 1 * 0 0 1 decided by lru (table 7.6) 1 0 1 * 0 decided by lru (table 7.7) 1 0 1 0 1 decided by lru (table 7.8) 1 0 * 1 1 way 2 1 1 1 0 * way 3 [legend] * : don't care note: the w2load and w3load bits should not be set to 1 at the same time. table 7.5 way to be replaced when a cache miss occurs in other than pref instruction cache locking mode bit w3load w3lock w2load w2lock way to be replaced 0 * * * * decided by lru (table 7.3) 1 * 0 * 0 decided by lru (table 7.3) 1 * 0 * 1 decided by lru (table 7.6) 1 * 1 * 0 decided by lru (table 7.7) 1 * 1 * 1 decided by lru (table 7.8) [legend] * : don't care note: the w2load and w3load bits should not be set to 1 at the same time. table 7.6 lru and way replacement (when w2lock=1 and w3lock=0) lru (bits 5 to 0) way to be replaced 000000, 000001, 000100, 010100, 100000, 100001, 110000, 110100 3 000011, 000110, 000111, 001011, 001111, 010110, 011110, 011111 1 101001, 101011, 111000, 111001, 111011, 111100, 111110, 111111 0
section 7 cache rev. 4.00 sep. 14, 2005 page 186 of 982 rej09b0023-0400 table 7.7 lru and way replacement (when w2lock=0 and w3lock=1) lru (bits 5 to 0) way to be replaced 000000, 000001, 000011, 001011, 100000, 100001, 101001, 101011 2 000100, 000110, 000111, 001111, 010100, 010110, 011110, 011111 1 110000, 110100, 111000, 111001, 111011, 111100, 111110, 111111 0 table 7.8 lru and way replacement (when w2lock=1 and w3lock=1) lru (bits 5 to 0) way to be replaced 000000, 000001, 000011, 000100, 00 0110, 000111, 001011, 001111, 010100, 010110, 011110, 011111 1 100000, 100001, 101001, 101011, 11 0000, 110100, 111000, 111001, 111011, 111100, 111110, 111111 0 7.3 cache operation 7.3.1 searching cache if the cache is enabled (ce bit in ccr register is 1), whenever instruc tions or data in spaces of p0, p1, and p3 are accessed the cache will be searched to see if the desired instruction or data is in the cache. figure 7.2 illustrates the me thod by which the cache is s earched. the cache is a physical cache of which tag address hold an address. entries are selected using bits 11 to 4 of the address used to acce ss memory (virtual address) and the tag address of that entry is read. the physical address (bits 31 to 12) after translation and the physical address read from the ad dress section are compared. the ad dress comparison uses all four ways. when the comparison shows a match and the sel ected entry is valid (v = 1), a cache hit occurs. when the comparison does not show a match or the selected entry is not valid (v = 0), a cache miss occurs. figure 7. 2 shows a hit on way 1.
section 7 cache rev. 4.00 sep. 14, 2005 page 187 of 982 rej09b0023-0400 0 1 255 v u tag address lw0 lw1 lw2 lw3 address array (ways 0 to 3) data array (ways 0 to 3) 31 12 11 4 3 2 1 0 address cmp0 cmp1 cmp2 cmp3 physical address [legend] cmp0: comparison circuit for way 0 cmp1: comparison circuit for way 1 cmp2: comparison circuit for way 2 cmp3: comparison circuit for way 3 hit signal (1) entry selection longword (lw) selection mmu figure 7.2 cache search scheme
section 7 cache rev. 4.00 sep. 14, 2005 page 188 of 982 rej09b0023-0400 7.3.2 read access read hit: in a read access, instructions and data are transferred from the cache to the cpu. lru is updated so that the hit way is the latest. read miss: an external bus cycle starts and the entry is updated. the way replaced follows table 7.5. entries are updated in 16-byte units. when the desired instruction or data that caused the miss is loaded from external memory to the cache, the instruction or da ta is transferred to the cpu in parallel with being loaded to the cache. when it is loaded in the cache, the u bit is cleared to 0 and the v bit is set to 1. lru is updated so that the replaced way becomes the latest. when the u bit of the entry to be replaced by updating the entr y in write-back mode is 1, the cache update cycle starts after the entry is transferred to the write -back buffer. after the cac he completes its update cycle, the write-back buff er writes the entry back to the memo ry. the write-back unit is 16 bytes. 7.3.3 prefetch operation prefetch hit: lru is updated so that the hit way becomes the latest. the contents in other caches are not modified. no instructions or data is transferred to the cpu. prefetch miss: no instructions or data is transferred to the cpu. the way to be replaced follows table 7.4. other operations are the same in case of read miss. 7.3.4 write access write hit: in a write access in write-back mode, the data is written to the cache and no external memory write cycle is issued. the u bit of the entry written is set to 1 and lru is updated so that the hit way becomes the latest. in write-through mode, the data is written to the cache and an external memory write cycle is issued. the u bit of the written entry is not updated and lru is updated so that the replaced way becomes the latest. write miss: in write-back mode, an external bus cycle starts when a write miss occurs, and the entry is updated. the way to be replaced follows table 7.5. when the u bit of the entry to be replaced is 1, the cache update cycle starts after the entry is transferred to the write-back buffer. the write-back unit is 16 bytes. data is written to the cache and the u bit is set to 1. v bit is set to 1. lru is updated so that the replaced way b ecomes the latest. after the cache completes its update cycle, the write-back buffer writes the entr y back to the memory. in write-through mode, no write to cache occurs in a write miss; the write is only to the external memory.
section 7 cache rev. 4.00 sep. 14, 2005 page 189 of 982 rej09b0023-0400 7.3.5 write-back buffer when the u bit of the entry to be replaced in the write-back mode is 1, it must be written back to the external memory. to increase performance, the entry to be replaced is first transferred to the write-back buffer and fetching of new entries to the cache takes priority over writing back to the external memory. after the cache completes to fetch the new entry, the write-back buffer writes the entry back to external memory. during the write-back cycles, the cache can be accessed. the write-back buffer can hold one line of cache data (16 bytes) and its physical address. figure 7.3 shows the configuration of the write-back buffer. longword 0 longword 1 longword 2 longword 3 pa (31 to 4) pa (31 to 4): longword 0 to 3: physical address written to external memory the line of cache data to be written to external memory figure 7.3 write-back buffer configuration 7.3.6 coherency of cach e and external memory use software to ensure coherency between the cache and the external memory. when memory shared by this lsi and another device is mapped in the address space to be cached, operate the memory mapped cache to invalidate and write back as required.
section 7 cache rev. 4.00 sep. 14, 2005 page 190 of 982 rej09b0023-0400 7.4 memory-mapped cache to allow software management of the cache, cache contents can be read an d written by means of mov instructions. the cache is mapped onto the p4 area. the address array is mapped onto addresses h'f0000000 to h'f0ffffff, and the data array onto addresses h'f1000000 to h'f1ffffff. only longword can be used as the access size for the address array and data array, and instruction fetches cannot be performed. 7.4.1 address array the address array is mapped onto h'f0000000 to h'f0ffffff. to access an address array, the 32-bit address field (for read/write accesses) and 32-bit data field (for write accesses) must be specified. the address field specifi es information for se lecting the entry to be accessed; the data field specifies the address, v bit, u bit, and lru bits to be written to the address array (figure 7.4 (1)). in the address field, specify the entry address selecting the entry (bits 11 to 4), w for selecting the way (bits 13 and 12). a for specifying the existen ce of associates operation and h'f0 to indicate address array access (bits 31 to 24). in w (bits 13 and 12), 00 is way 0, 01 is way 1, 10 is way 2, and 11 is way 3. 7.4.2 data array the data array is mapped onto h'f1000000 to h'f1ffffff. to access a data array, the 32-bit address field (for read/write accesses) and 32-bit da ta field (for write accesse s) must be specified. the address field specifies info rmation for selecting the entry to be accessed; the data field specifies the longword data to be written to the data array. specify the entry address for selecting the entry (b its 11 to 4), l indicating the longword position within the (16-byte) line, w for selecting the way (bits 13 and 12), and h'f1 to indicate data array access (bits 31 to 24). in l (bits 3 and 2), 00 is longword 0, 01 is longword 1, 10 is longword 2, and 11 is longword 3. in w (bits 13 and 12), 00 is way 0, 01 is way 1, 10 is way 2, and 11 is way 3. the access size of the data array is fixed at longword, so specify 00 for bits 1 and 0. following two operations are possible for the data array. information in the address array is not modified by this operation.
section 7 cache rev. 4.00 sep. 14, 2005 page 191 of 982 rej09b0023-0400 data array read: the data specified by l (bits 3 and 2) in the address is read from the entry address specified by the address and the entry corresponding to the way. data array write: the longword data specified by the data is written to the position specified by l (bits 3 and 2) in the address from the entry address specified by the address and the entry corresponding to the way. 1. address array access (a) address specification read access write access (b) data specification (both read and write accesses) 2. data array access (both read and write accesses) (a) address specification 31 24 23 14 13 12 11 4 3 0 1111 0000 * ???? * * ???? * * ???? * 0 0 0 0 0 0 w entry 31 24 23 14 13 12 11 4 3 0 1111 0000 w entry 2 a 31 30 29 10 4 3 0 lru 2 x 000 x 9 address tag (28 to 10) u v 1 31 24 23 14 13 12 11 4 3 0 1111 0001 w entry 0 0 12 l (b) data specification 31 0 longword * : don't care bit x: 0 for read, don't care for write [legend] 0 2 figure 7.4 specifying address and data for memory-m apped cache access
section 7 cache rev. 4.00 sep. 14, 2005 page 192 of 982 rej09b0023-0400 7.4.3 usage examples invalidating specific entries specific cache entries can be invalidated by writing 0 to the entry's v bit in the memory mapping cache access. when the a bit is 1, the address tag sp ecified by the write data is compared to the address tag within the cache select ed by the entry address, and data is written to the bits v and u specified by the write data when a match is found. if no match is found, there is no operation. when the v bit of an entry in the address array is se t to 0, the entry is written back if the entry's u bit is 1. an example when a write data is specified in r0 an d an address is specified in r1 is shown below. ; r0=h'0110 0000; tag address=b'0000 0001 0001 0000 0000 00, u=0, v=0 ; r1=h'f000 0088; address array access, entry=b'00001000, a=1 ; mov.l r0,@r1 reading the data of a specific entry the data section of a specific cache entry can be read by the memory mapping cache access. the longword indicated in the data field of the data array in figure 7.4 is read into the register. an example when an address is specifi ed in r0 and data is read in r1. ; r0= h'f100 004c; data array access, entry= b'00000100, ; way= 0, longword address= 3 ; mov.l @r0,r1 ; longword 3 is read.
section 8 x/y memory rev. 4.00 sep. 14, 2005 page 193 of 982 rej09b0023-0400 section 8 x/y memory this lsi has on-chip x-ram and y-ram. it can be used by cpu, dsp and dmac to store instructions or data. 8.1 features the x/y memory features are listed in table 8.1. table 8 . 1 x/y memory specifications parameter features addressing method mapping is possible in space p0 or p2 ports 3 independent read/write ports ? 8-/16-/32-bit access by the cpu (via l bus or i bus) ? maximum of two simultaneous 16-bit accesses (via x and y buses), or 16/32-bit accesses, by the dsp (via l bus) ? 8-/16-/32-bit access by the dmac (via i bus) size 8-kbyte ram for x and y memory each the x memory resides in addresses h'05007000 to h'05008fff in space p0 or addresses h'a5007000 to h'a5008fff (8 kb ytes) in space p2. the x ram is divided into page 0 and page 1 according to the addresses. the x memory can be accessed from the l bus, x bus, and i bus. the y memory resides in addresses h'05017000 to h'05018fff in space p0 or addresses h'a5017000 to h'a5018fff (8 kb ytes) in space p2. the x ram is divided into page 0 and page 1 according to the addresses. the y memory can be accessed from the l bus, y bus, and i bus. in the event of simultaneous accesses to the same page from different buses, the priority order is: i bus > x bus > l bus in the x memory and i bus > y bus > l bus in the y memory. since this kind of contention tends to lower x/y memory accessibility, it is advisable to provide software measures to prevent such contention as far as possi ble. for example, conten tion will not arise if different memory or different pages are accessed by each bus. x/y memory is accessed by the cp u or dsp from space p0 via the i bus, a contention with the dmac may occur on the i bus. since this kind of contention also tends to lower x/y memory accessibility, it is advisable to provide software m easures to prevent such contention as far as possible. for example, c ontention on the i bus can be preven ted by using space p2 when the x/y memory is accessed by the cpu or dsp.
section 8 x/y memory rev. 4.00 sep. 14, 2005 page 194 of 982 rej09b0023-0400 8.2 x/y memory access from cpu the x/y memory can be accessed by the cpu from spaces p0 and p2. acce ss from space p0 uses the i bus, and access from space p2 use the l bu s. to use the l bus, one cycle access is performed unless page conflict occurs. using the i bus takes more than one cycle access. figure 8.1 shows x/y memory address mapping. reserved reserved reserved reserved x memory page0 4 kbytes x memory page1 4 kbytes y memory page0 4 kbytes y memorypage1 4 kbytes area1, 64 mbytes x/y memory spece address a[28:0] address a[28:0] i/o space 16 mbytes reserved u memory reserved h'04000000 h'05000000 h'0501ffff h' 055f0000 h'0560ffff h'05610000 h'07ffffff h'05000000 h'05007000 h'05008000 h'05009000 h'0500ffff h'05010000 h'05017000 h'05018000 h'05019000 h'0501ffff figure 8 . 1 x/y memory address mapping 8.3 x/y memory access from dsp the x/y memory can be accessed by the dsp from spaces p0 and p2. methods for accessing differ according to instructions. accesses via th e x bus/y bus are always 16-bit, while accesses via the l bus are either 16-bit or 32-bit. to us e the l bus, one cycle access is performed unless page conflict occurs. using the i bus takes more than one cycle access. with x data transfer instructions and y data tran sfer instructions, the x/y memory is accessed via the x bus or y bus. these accesses are always 16-bit. in the case of a single data transfer instruction, the x/y memory is accessed via the l bus. in this case the access is either 16-bit or 32-bit. accesses via the x bus and y bus ca n be specified simultaneously.
section 8 x/y memory rev. 4.00 sep. 14, 2005 page 195 of 982 rej09b0023-0400 8.4 x/y memory access from dmac the x/y memory can be accessed by the dmac via the i bus. use the addresses between h'05007000 and h'05008fff or h'05017000 and h'05018fff. 8.5 usage note when accessing the x/y memory from the cpu and dsp, if the cache is on, access must be performed from space p2 (non-cacheable space). operation duri ng access from space p0 cannot be guaranteed. when the cache is off, spaces p0 and p2 can both be used. specify the p2 area for parallel operation and double data transfer. (see section 3.1.9, data transfer operation.) 8.6 sleep mode in sleep mode, the x/y memory is not accessed fr om the i bus master module such as dmac. 8.7 address error when an address error in write access to the x/y memory occur, the conten ts of the x/y memory may be corrupted.
section 8 x/y memory rev. 4.00 sep. 14, 2005 page 196 of 982 rej09b0023-0400
section 9 exception handling rev. 4.00 sep. 14, 2005 page 197 of 982 rej09b0023-0400 section 9 exception handling exception handling is separate from normal program processing, and is performed by a routine separate from the normal program. for example, if an attempt is made to execute an undefined instruction code or an instruction protected by the cpu processing mode, a control function may be required to return to the source program by executing the appropriate opera tion or to report an abnormality and carry out end processing. in additio n, a function to control processing requested by lsi on-chip modules or an lsi external module to the cpu may also be required. transferring control to a user-defined exception processing routine and executing the process to support the above functions are called exception handling. this lsi has two types of exceptions: general exceptions and interrupts. the user can execute the required processing by assigning exception handling routines corresponding to the required exception processing and then return to the source program. a reset input can terminate the normal program execution and pass control to the reset vector after register initialization. this reset operation can also be regarded as an exception handling. this section describes an overview of the exception handling operation. here, general exceptions and interrupts are referred to as exception handling. for interrupts, this section describes only the process executed for interrupt requests. for details on how to generate an interrupt request, refer to section 10, interrupt controller (intc).
section 9 exception handling rev. 4.00 sep. 14, 2005 page 198 of 982 rej09b0023-0400 9.1 register descriptions there are three registers for exception handling. a register with an undefined initial value should be initialized by the software. ? trapa exception register (tra) ? exception event register (expevt) ? interrupt event register 2 (intevt2) figure 9.1 shows the bit configuration of each register. 31 tra expevt intevt2 tra expevt intevt2 10 9 2 1 0 31 12 11 0 0 0 0 0 31 12 11 0 figure 9.1 register bit configuration 9.1.1 trapa exception register (tra) tra is assigned to address h'ffffffd0 and consis ts of the 8-bit immediate data (imm) of the trapa instruction. tra is automatically specified by the hardware when the trapa instruction is executed. only bits 9 to 2 of the tra can be re-written using the software. bit bit name initial value r/w description 31 to 10 ? ? r reserved these bits are always read as 0. the write value should always be 0. 9 to 2 tra ? r/w 8-bit immediate data 1, 0 ? ? r reserved these bits are always read as 0. the write value should always be 0.
section 9 exception handling rev. 4.00 sep. 14, 2005 page 199 of 982 rej09b0023-0400 9.1.2 exception event register (expevt) expevt is assigned to address h'ffffffd4 and consists of a 12-bit exception code. exception codes to be specified in expevt are those for resets and general exceptions. these exception codes are automatically specified the hardware wh en an exception occurs. only bits 11 to 0 of expevt can be re-written using the software. bit bit name initial value r/w description 31 to 12 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 11 to 0 expevt * r/w 12-bit exception code note: * initialized to h'000 at power-on reset and h'020 at manual reset. 9.1.3 interrupt event register 2 (intevt2) intevt2 is assigned to address h'a4000000 and consists of a 12-bit exception code. exception codes to be specified in intevt2 are those for interrupt requests. these exception codes are automatically specified by the hardware when an exception occurs. intevt2 cannot be modified using the software. bit bit name initial value r/w description 31 to 12 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 11 to 0 intevt2 ? r/w 12-bit exception code note: initialized to h'000 at power-on reset and h'020 at manual reset.
section 9 exception handling rev. 4.00 sep. 14, 2005 page 200 of 982 rej09b0023-0400 9.2 exception handling function 9.2.1 exception handling flow in exception handling, the contents of the program counter (pc) and status register (sr) are saved in the saved program counter (spc) and saved status register (ssr), respectively, and execution of the exception handler is invoked from a vector address. the return from exception handler (rte) instruction is issued by the exception handler routine on completion of the routine, restoring the contents of pc and sr to return to the processor state at the point of interruption and the address where the exception occurred. a basic exception handling sequence consists of the following operations. if an exception occurs and the cpu accepts it, operations 1 to 8 are executed. 1. the contents of pc is saved in spc. 2. the contents of sr is saved in ssr. 3. the block (bl) bit in sr is set to 1, masking any subsequent exceptions. 4. the register bank (rb) bit in sr is set to 1. 5. an exception code identifying the exception event is written to bits 11 to 0 of the exception event (expevt) or interrup t event (intevt2) register. 6. if a trapa instruction is executed, an 8-bit immediate data specified by the trapa instruction is set to tra. 7. instruction execution jumps to the designated exception vector address to invoke the handler routine. the above operations from 1 to 7 are executed in sequence. during these operations, no other exceptions may be accepted unless multiple exception accepta nce is enabled. in an exception handling routine for a general exception, the appropriat e exception handling must be executed based on an exception source determined by the expevp. in an interrupt exception handling routine, the appropriate exception handlin g must be executed based on an exception source determined by the intevt2. after the exception handling routine has been completed, program execution can be resumed by executing an rte instruction. the rte instruction causes the following operatio ns to be executed. 1. the contents of the ssr are restored into the sr to return to the pro cessing state in effect before the exception handling took place. 2. a delay slot instruction of the rte instruction is executed. 3. control is passed to the address stored in the spc.
section 9 exception handling rev. 4.00 sep. 14, 2005 page 201 of 982 rej09b0023-0400 the above operations from 1 to 3 are executed in sequence. during these operations, no other exceptions may be accepted. by changing the spt and ssr before executing the rte instruction, a status different from that in effect before the exception handling can also be specified. note: for details on the cpu processing mode in which rte delay slot instructions are executed, please refer to s ection 9.6, usage notes. 9.2.2 exception vector addresses a vector address for general exceptions is determined by adding a vector offset to a vector base address. the vector offset for general excep tions other than the tlb error exception is h'00000100. the vector offset for interrupts is h'00000600. the vector base address is loaded into the vector base register (vbr) using the software. 9.2.3 exception codes the exception codes are written to bits 11 to 0 of the expevt register (for reset or general exceptions) or the intevt2 register (for interrupt requests) to identify each specific exception event. see section 10, interrupt controller (intc), for details of the exception codes for interrupt requests. table 9.1 lists exception codes for resets and general exceptions. 9.2.4 exception request and bl bit (multiple exception prevention) the bl bit in sr is set to 1 when a reset or exception is accepted. while th e bl bit is set to 1, acceptance of general exceptions is restricted as de scribed below, making it possible to effectively prevent multiple excep tions from being accepted. if the bl bit is set to 1, an interrupt request is not accepted and is retained. the interrupt request is accepted when the bl bit is clear ed to 0. if the cpu is in low power consum ption mode, an interrupt is accepted even if the bl bit is set to 1 and the cpu returns from the low power consumption mode. a dma error is not accepted and is retained if the bl bit is set to 1 and accepted when the bl bit is cleared to 0. user break requests generated while the bl bit is set are ignored and are not retained. accordingly, user breaks are not accep ted even if the bl bit is cleared to 0. if a general exception other than a dma address error or user break occurs while the bl bit is set to 1, the cpu enters a state similar to that in e ffect immediately after a re set, and passes control to the reset vector (h'a0000000) (multiple exception). in this case, unlike a normal reset, modules
section 9 exception handling rev. 4.00 sep. 14, 2005 page 202 of 982 rej09b0023-0400 other than the cpu are not initialized, the contents of expevt, spc, and ssr are undefined, and this status is not detected by an external device. to enable acceptance of multiple exceptions, the contents of spc and ssr must be saved while the bl bit is set to 1 after an exception has been accepted, and then the bl bit must be cleared to 0. before restoring the spc and ssr, the bl bit must be set to 1. 9.2.5 exception source accepta nce timing and priority exception request of instruction synchronou s type and instruction asynchronous type: resets and interrupts are requested asynchronously regardless of the program flow. in general exceptions, a dma address error and a user break under the specific condition are also requested asynchronously. the user cannot expect on whic h instruction an exception is requested. for general exceptions other than a dma address error and a user break under a specific condition, each general exception corresponds to a specific instruction. re-execution type and processi ng-completion type exceptions: all exceptions are classified into two types: a re-execution type and a processing-completion type. if a re-execution type exception is accepted, the curr ent instruction exec uted when the exception is accepted is terminated and the instruction address is saved to the spc. after returning from the exception processing, program execution resu mes from the instruction where the exception was accepted. in a processing-completion type exception, the curr ent instruction executed when the exception is accepted is completed, the next in struction address is saved to the spc, and then the exception processing is executed. during a delayed branch instruction and delay slot, the following operations are executed. a re- execution type exception detected in a delay slot is accepted before executing the delayed branch instruction. a processing-completion type exception detected in a delayed branch instruction or a delay slot is accepted when the delayed branch in struction has been executed. in this case, the acceptance of delayed branch instru ction or a delay slot precedes the execution of the branch destination instruction. in the above description, a delay slot indicates an instruction following an unconditional delayed branch instruction or an instruction following a conditional delayed branch instruction whose branch condition is satisfied. if a branch does not occur in a conditional delayed branch, the normal processing is executed. acceptance priority and test priority: acceptance priorities are de termined for all exception requests. the priority of resets, general exceptions , and interrupts are determined in this order: a reset is always accepted regardless of the cpu stat us. interrupts are accepted only when resets or general exceptions are not requested.
section 9 exception handling rev. 4.00 sep. 14, 2005 page 203 of 982 rej09b0023-0400 if multiple general exceptions occur simultaneously in the same instruction, the priority is determined as follows. 1. a processing-completion type exception generated at the previous instruction* 2. a user break before instruction execution (re-execution type) 3. an exception related to an instruction fetch (cpu address error: re-execution type) 4. an exception caused by an instruction decode (general illegal instru ction exceptions and slot illegal instruction exceptions: re-execution type , unconditional trap: processing-completion type) 5. an exception related to data access (cpu address error: re-execution type) 6. unconditional trap (processing-completion type) 7. a user break other than one before instruction execution (processing-completion type) 8. dma address error note: if a processing-completion type exception is accepted at an inst ruction, exception processing starts before the next instruction is executed. this exception processing executed before an exception generated at the next instruction is detected. only one exception is accepted at a time. accepting multiple exceptions sequenti ally results in all exception requests being processed.
section 9 exception handling rev. 4.00 sep. 14, 2005 page 204 of 982 rej09b0023-0400 table 9.1 exception event vectors exception type current instruction exception event priority * 1 exception order process at bl=1 vector code vector offset power-on reset 1 1 reset h'a00 ? reset aborted manual reset 1 2 reset h'020 ? h-udi reset 1 1 reset h'000 ? user break (before instruction execution) 2 0 ignored h'1e0 h'00000100 general exception events re-executed cpu address error (instruction access) * 4 2 1 reset h'0e0 h'00000100 illegal general instruction exception 2 2 reset h'180 h'00000100 illegal slot instruction exception 2 2 reset h'1a0 h'00000100 cpu address error (data access) * 4 2 3 reset h'0e0/ h'100 h'00000100 unconditional trap (trapa instruction) 2 4 reset h'160 h'00000100 completed user breakpoint (after instruction execution, address) 2 5 ignored h'1e0 h'00000100 user breakpoint (data break, i-bus break) 2 5 ignored h'1e0 h'00000100 general exception events completed dma address error 2 6 retained h'5c0 h'00000100 general interrupt requests completed interrupt requests 3 ? * 2 retained ? * 3 h'00000600 notes: 1. priorities are indicated from high to low, 1 being the highest and 3 the lowest. a reset has the highest priority. an interrupt is accepted only when general exceptions are not requested. 2. for details on priorities in multiple in terrupt sources, refer to section 10, interrupt controller (intc). 3. if an interrupt is accepted, the exception event register (expevt) is not changed. the interrupt source code is specified in interr upt source register 2 (intevt2). for details, refer to section 10, inte rrupt controller (intc). 4. if one of these exceptions occurs in a specif ic part of the repeat loop, a specific code and vector offset are specified.
section 9 exception handling rev. 4.00 sep. 14, 2005 page 205 of 982 rej09b0023-0400 9.3 individual exception operations this section describes the conditions for specific exception handling, and the processor operations. 9.3.1 resets power-on reset: ? conditions power-on reset is request ? operations set expevt to h'000, initialize the cpu and on-chip peripheral modules, and branch to the reset vector h'a0000000. for details, refer to the register descriptions in the relevant sections. manual reset: ? conditions manual reset is request ? operations set expevt to h'020, initialize the cpu and on-chip peripheral modules, and branch to the reset vector h'a0000000. for details, refer to the register descriptions in the relevant sections. h-udi reset: ? conditions the h-udi reset command is entered (see section 15.4.4, h-udi reset.) ? operations set expevt to h'000, initialize the vbr and sr, and branch to the pc h'a0000000. the vbr register is set to h'00000000 by initia lization. for the sr, the bl and rb bits are set to 1 and the interrupt mask bits (i3 to i0) are set to 1111. initialize the cpu and on-chip peripheral modules. for details, refer to the register descriptions in the relevant sections.
section 9 exception handling rev. 4.00 sep. 14, 2005 page 206 of 982 rej09b0023-0400 table 9.2 type of reset internal state type condition to reset cpu on-chip peripheral module power-on reset resetp = low level manual reset resetm = low level h-udi reset h-udi reset command entry initialization refer to the register configurations in the relevant sections. 9.3.2 general exceptions cpu address error: ? conditions ? instruction is fetched from odd address (4n + 1, 4n + 3) ? word data is accessed from addresses other than word boundaries (4n + 1, 4n + 3) ? long word is accessed from addresses other than longword boundaries (4n + 1, 4n + 2, 4n + 3) ? the area ranging from h'8000000 0 to h'ffffffff in logical space is accessed in user mode ? types instruction synchronous, re-execution type ? save address instruction fetch: an instruction address to be fetched when an exception occurred data access: an instruction address where an ex ception occurs (a delayed branch instruction address if an instruction is assigned to a delay slot) ? exception code an exception occurred during read: h'0e0 an exception occurred during write: h'1e0 ? remarks none
section 9 exception handling rev. 4.00 sep. 14, 2005 page 207 of 982 rej09b0023-0400 illegal general instruction exception: ? conditions ? when undefined code not in a delay slot is decoded delayed branch instructions: jmp, jsr, bra, braf, bsr, bsrf, rts, rte, bt/s, bf/s note: for details on undefined code, refer to sh-3/sh-3e/sh-3dsp software manual. when an undefined code other than h'fc00 to h'ffff is decoded, operation cannot be guaranteed. ? types instruction synchronous, re-execution type ? save address an instruction address wh ere an exception occurs ? exception code h'180 ? remarks none illegal slot instruction: ? conditions ? when undefined code in a delay slot is decoded delayed branch instructions: jmp, jsr, bra, braf, bsr, bsrf, rts, rte, bt/s, bf/s ? when an instruction that rewrites pc in a delay slot is decoded instructions that rewrite pc: jmp, jsr, bra, braf, bsr, bsrf, rts, rte, bt, bf, bt/s, bf/s, trapa, ldc rm, sr, ldc.l @rm+, sr ? types instruction synchronous, re-execution type ? save address a delayed branch instruction address ? exception code h'1a0 ? remarks none
section 9 exception handling rev. 4.00 sep. 14, 2005 page 208 of 982 rej09b0023-0400 unconditional trap: ? conditions trapa instruction executed ? types instruction synchronous, processing-completion type ? save address an address of an instruction following trapa ? exception code h'160 ? remarks the exception is a processing-completion type , so pc of the instruction after the trapa instruction is saved to spc. the 8-bit immediate value in the trapa instruction is quadrupled and set in tra9 to tra0. user break point trap: ? conditions when a break condition set in the us er break controller is satisfied ? types break (l bus) before instru ction execution: instruction synchronous, re-execution type operand break (l bus): instruction synchronous, processing-completion type data break (l bus): instruction asynchronous, processing-completion type i bus break: instruction asynchronous, processing-completion type ? save address re-execution type: an address of the instruction where a break occurs (a delayed branch instruction address if an instruc tion is assigned to a delay slot) operand break (l bus): an addr ess of the instruction following the instruction where a break occurs (a delayed branch instruction destination address if an instruction is assigned to a delay slot) data break (l bus): instruction asynchronous, processing-completion type ? exception code h'1e0 ? remarks for details on user break controller, refer to section 11, user break controller (ubc).
section 9 exception handling rev. 4.00 sep. 14, 2005 page 209 of 982 rej09b0023-0400 dma address error: ? conditions ? word data accessed from addresses other than word boundaries (4n + 1, 4n + 3) ? longword accessed from addresses other than longword boundaries (4n + 1, 4n + 2, 4n + 3) ? types instruction synchronous, processing-completion type ? save address an address of the instruction following the inst ruction where a break occurs (a delayed branch instruction destination address if an instruction is assigned to a delay slot) ? exception code h'5c0 ? remarks an exception occurs when a dma transfer is executed while an illegal instruction address described above is specified in the dmac. since the dma transfer is performed asynchronously with the cpu instruction op eration, an exception is also requested asynchronously with the instruction execution. for details on dmac, refer to section 13, direct memory acce ss controller (dmac).
section 9 exception handling rev. 4.00 sep. 14, 2005 page 210 of 982 rej09b0023-0400 9.4 exception processing while dsp extension function is valid when the dsp extension function is valid (the dsp bit of sr is set to 1), some exception processing acceptance conditions or exception processing may be changed. 9.4.1 illegal instruction exception a nd slot illegal instruction exception in the dsp mode, a dsp extension instruction can be executed. if a dsp ex tension instruction is executed when the dsp bit of sr is cleared to 0 (in a mode other than the dsp mode), an illegal instruction exception occurs. 9.4.2 exception in repeat control period if an exception is requested or an exception is accepted during repeat control, the exception may not be accepted correctly or a program executio n may not be returned correctly from exception processing that is different fr om the normal state. these restrictions may occur from repeat detection instruction to repeat end instruction while the repeat counter is 1 or more. in this section, this period is called the repeat control period. the following shows program exampl es where the number of instructions in th e repeat loop are 4 or more, 3, 2, and 1, respectively. in this section, a repeat detection instruction and its instruction address are described as rptdtct. the first, sec ond, and third instructions following the repeat detection instruction are described as rptdtct1, rptdtct2, and rptdtct2. in addition, [a], [b], [c1], and [c2] in the following examples indi cate instructions where a restriction occurs. table 9.3 summarizes the instruction positions and restriction types. table 9.3 instruction positi ons and restriction types instruction position spc * 1 illegal instruction * 2 interrupt, break * 3 cpu address error * 4 [a] [b] retained [c1] added retained instruction/data [c2] illegal added retained instruction/data notes: 1. a specific address is specified in the spc if an exception oc curs while sr.rc[11:0] 2. 2. there are a greater number of instructions that can be illegal instructions while sr.rc[11:0] 1. 3. an interrupt break or dma address e rror request is retain ed while sr.rc[11:0] 1. 4. a specific exception code is specified while sr.rc[11:0] 1.
section 9 exception handling rev. 4.00 sep. 14, 2005 page 211 of 982 rej09b0023-0400 ? example 1: repeat loop consisting of four instructions ldrs rptstart ; [a] ldrs rptdtct + 4 ; [a] setrct #4 ; [a] instr0 ; [a] rptstart: instr1 ; [a] ??? ; [a] ??? ; [a] rptdtct: rptdtct ; [b] a repeat detection instruction is an instruction three instructions before a repeat end instruction rptdtct1 ; [c1] rptdtct2 ; [c2] rptend: rptdtct3 ; [c2][repeat end instruction] instrnext ; [a] ? example 2: repeat loop consisting of three instructions ldrs rptdtct + 4 ; [a] ldrs rptdtct + 4 ; [a] setrct #4 ; [a] rptdtct: rptdtct ; [b] a repeat detection instruction is an instruction prior to a repeat start instruction rptstart: rptdtct1 ; [c1][repeat start instruction] rptdtct2 ; [c2] rptend: rptdtct3 ; [c2][repeat end instruction] instrnext ; [a]
section 9 exception handling rev. 4.00 sep. 14, 2005 page 212 of 982 rej09b0023-0400 ? example 3: repeat loop consisting of two instructions ldrs rptdtct + 6 ; [a] ldrs rptdtct + 4 ; [a] setrct #4 ; [a] rptdtct: rptdtct ; [b] a repeat detection instruction is an instruction prior to a repeat start instruction rptstart: rptdtct1 ; [c1][repeat start instruction] rptend: rptdtct3 ; [c2][repeat end instruction] instrnext ; [a] ? example 4: repeat loop consisting of one instruction ldrs rptdtct + 8 ; [a] ldrs rptdtct + 4 ; [a] setrct #4 ; [a] rptdtct: rptdtct ; [b] a repeat detection instruction is an instruction prior to a repeat start instruction rptstart: rptend: rptdtct1 ; [c1][repeat start instruction]== [repeat end instruction] instrnext ; [a] spc saved by an exception in repeat control period: if an exception is accepted in the repeat control period while the repeat counter (rc11 to rc0) in the sr register is two or greater, the program counter to be saved may not indicate the value to be returned correctly. to execute the repeat control after returning from an exception processing, the re turn address must indicate an instruction prior to a repeat de tection instruction. ac cordingly, if an exception is accepted in repeat control period, an exception other than re-execution type exception by a repeat detection instruction cannot return to the repeat control correctly.
section 9 exception handling rev. 4.00 sep. 14, 2005 page 213 of 982 rej09b0023-0400 table 9.4 spc value when a re-execution ty pe exception occurs in repeat control number of instructions in a repeat loop instruction where an exception occurs 1 2 3 4 or greater rptdtct rptdtct rptd tct rptdtct rptdtct rptdtct1 rptdtct1 rptdtc t1 rptdtct1 rptdtct1 rptdtct2 ? rptdtct1 rptdtct1 rs-4 rptdtct3 ? ? rptdtct1 rs-2 note: the following labels are used here. rptdtct: repeat detection instruction address rptdtct1: an instruction address one instructi on following the repeat detection instruction rptdtct2: an instruction address two instruct ion following the repeat detection instruction rptdtct3: an instruction address three instruct ion following the repeat detection instruction rs: repeat start instruction address if a re-execution type exception is accepted at an instruction in the hatched areas above, a return address to be saved in the spc is incorrec t. if sr.rc[11:0] is 1 or 0, a correct return address is saved in the spc. illegal instruction exception in repeat control period: if one of the following instructions is executed at the address following rptdtct1, a gene ral illegal instruction exception occurs. for details on an address to be saved in the spc, refer to spc saved by an exception in repeat control period description in section 9.4.2, exception in repeat control period. ? branch instructions bra, bsr, bt, bf, bt/s, bf/s, bsrf, rts, braf, rte, jsr, jmp, trapa ? repeat control instructions setrc, ldrs, ldre ? load instructions for sr, rs, and re ldc rn,sr, ldc @rn+,sr, ldc rn,re, ld c @rn+,re, ldc rn,rs, ldc @rn+, rs note: in a repeat loop consisting of one to three instructions, some restrictions apply to repeat detection instructions and all the remaining instructions. in a repeat loop consisting of four or more instructions, restrictions apply to only the three instructions that include a repeat end instruction.
section 9 exception handling rev. 4.00 sep. 14, 2005 page 214 of 982 rej09b0023-0400 an exception retained in repeat control period: in the repeat control period, an interrupt or some exception will be retained to prevent an exception acceptance at an instruction where returning from the exception cannot be performed correctly. for details, refer to repeat loop program example 1 to 4. in the examples, exceptions generated at instructions indicated as [b], [c], [c1], or [c2], the follo wing processing is executed. ? interrupt, dma address error an exception request is not accepted and retained at instructions [b] and [c]. if an instruction indicates as [a] is executed the next time, an exception request is accepted.* as shown in example 1 to 4, any interrupt or dma address error cannot be accepted in a repeat loop consisting of four instructions or less. note: * an interrupt request or a dma addres s error exception request is retained in the interrupt controller (intc) and the direct memory access controller (dmac) until the cpu can accept a request. ? user break before instruction execution a user break before instructio n execution is accepted at instruct ion [b], and an address of instruction [b] is saved in the spc. this exce ption cannot be accepted at instruction [c] but the exception request is retained until an instruction [a] or [b] is executed the next time. then, the exception request is accepted before an instruc tion [a] or [b] is executed. in this case, an address of instruction [a] or [b] is saved in the spc. ? user break after instruction execution a user break after instruction execution cannot be accepted at instructions [b] and [c] but the exception request is retained until an instruction [a ] or [b] is executed the next time. then, the exception request is accepted before an instruction [a] or [b] is executed. in this case, an address of instruction [a] or [b] is saved in the spc. table 9.5 exception accept ance in the repeat loop exception type instruction [b] instruction [c] interrupt not accepted not accepted dma address error not accepted not accepted user break before instruction ex ecution accepted not accepted user break after instruction exec ution not accepted not accepted
section 9 exception handling rev. 4.00 sep. 14, 2005 page 215 of 982 rej09b0023-0400 cpu address error in repeat control period: if a cpu address error occurs in the repeat control period, the exception is accepted but an ex ception code (h'070) indicating the repeat loop period is specified in the expevt. if a cpu ad dress error occurs in in structions following a repeat detection instruction to re peat end instruction, an exceptio n code for instru ction access or data access is specified in the expevt. the spc is saved according to the spc saved by an exception in repeat control period description in section 9.4.2, exception in repeat control period. after the cpu address error excepti on processing, the repeat control cannot be returned correctly. to execute a repeat loop correctly, care must be taken not to generate a cpu address error in the repeat control period. note: in a repeat loop consisting of one to three instructions, some restrictions apply to repeat detection instructions and all the remaining instructions. in a repeat loop consisting of four or more instructions, restrictions apply to only the three instructions that include a repeat end instruction. the restrict ion occurs when sr.rc[11:0] 1. table 9.6 instruction where a specific ex ception occurs when a memory access exception occurs in repeat control number of instructions in a repeat loop instruction where an exception occurs 1 2 3 4 or greater rptdtct rptdtct1 instruction/data access instruction/data access instruction/data access instruction/data access rptdtct2 ? instruction/data access instruction/data access instruction/data access rptdtct3 ? ? instruction/data access instruction/data access note: the following labels are used here. rptdtct: repeat detection instruction address rptdtct1: an instruction address one instructi on following the repeat detection instruction rptdtct2: an instruction address two instruct ion following the repeat detection instruction rptdtct3: an instruction address three instruct ion following the repeat detection instruction
section 9 exception handling rev. 4.00 sep. 14, 2005 page 216 of 982 rej09b0023-0400 9.5 note on initializing this lsi this lsi needs to be initialized by a software reset before the power is turned on. execute the following program immediately after a power-on reset. note that the following program overwrites contents of cpu general registers. save contents of registers which should not be overwritten be fore executing the following program.
section 9 exception handling rev. 4.00 sep. 14, 2005 page 217 of 982 rej09b0023-0400 ;----------------------------------------------------------- ; intialization of SH7641 for power-on reset ;----------------------------------------------------------- ; attention: ; 1. please execute below instructions on power-on reset. ; 2. this routine would overwrite the general registers on the cpu. ; 3. do not modify these codes. ;----------------------------------------------------------- mov.l #h'a5007000,r4; mov.l #h'a5008000,r5; mov.l #h'a5017000,r6; mov.l #h'a5018000,r7; mov.l @r4,r0; mov.l @r5,r0; mov.l @r6,r0; mov.l @r7,r0; ; mov.w #h'ff40,r10; mov.l #h'a4fc0000,r8; mov #h'10,r9; mov.b r10,@r10; mov.b r10,@r10; mov.b r10,@r10; mov.l r9,@r8; ; mov.l #h'fc000000,r1; mov.w @r1,r0; ; mov #h'00,r9; mov.b r10,@r10; mov.b r10,@r10; mov.b r10,@r10; mov.l r9,@r8; ;-----------------------------------------------------------
section 9 exception handling rev. 4.00 sep. 14, 2005 page 218 of 982 rej09b0023-0400 9.6 usage notes 1. an instruction assigned at a delay slot of the rte instruction is executed after the contents of the ssr is restored into the sr. an acceptance of an exception related to instruction access is determined according to the sr before rest ore. an acceptance of other exceptions is determined by the sr after restore, processing mode, and bl bit value. a processing- completion type exception is accepted before an instruction at the r te branch destination address is executed. however, no te that the correct operation ca nnot be guaranteed if a re- execution type exception occurs. 2. in an instruction assigned at a delay slot of the rte instruction, a user break cannot be accepted. 3. if the bl bit of the sr register is changed by the ldc instruction, an exception is accepted according to the changed sr valu e from the next inst ruction.* a processi ng-complet ion type exception is accepted before the next instruction is executed. an interrupt and dma address error in re-execution type exce ptions are accepted before the next instruction is executed. note: * if an ldc instruction is executed for the sr, the following instru ctions are re-fetched and an instruction fetch exception is accept ed according to the modified sr value.
section 10 interrupt controller (intc) rev. 4.00 sep. 14, 2005 page 219 of 982 rej09b0023-0400 section 10 interrupt controller (intc) the interrupt controller (intc) ascertains the prior ity of interrupt sources and controls interrupt requests to the cpu. the intc registers set the order of priority of each interrupt, allowing the user to process interr upt requests according to the user-set priority. 10.1 features the intc has the following features: ? 16 levels of interrupt priority can be set by setting the ten interrupt-priority registers, th e priorities of on-chip peripheral modules, and irq interrupts can be selected from 16 levels for individual request sources. ? nmi noise canceler function an nmi input-level bit indicates the nmi pin state. by reading this bit in the interrupt exception service routine, the pin state can be checked, enabling it to be used as a noise canceler. ? irq interrupts can be set detection of low level, rising edge, falling edge, or high level ? interrupts can be enabled or disabled interrupts can be enabled or disabled individually for each interrupt source with the interrupt mask registers (imr) and interr upt mask clear registers (imcr).
section 10 interrupt controller (intc) rev. 4.00 sep. 14, 2005 page 220 of 982 rej09b0023-0400 figure 10.1 shows a block diagram of the intc. dmac scif0 to 2 adc usb cmt0 and cmt1 mtu0 to mtu4 wdt h-udi iic2 8 dmac: scif: adc: usb: cmt: mtu: wdt: h-udi: dma controller serial communication interfaces (with fifo) 0 to 2 a/d converter usb funciton module compare match timers 0 and 1 multifuncton timer pulse units 0 to 4 watchdog timer user debugging interface iic2: icr: ipr: imr: imcr: irr0: sr: i 2 c interface 2 interrupt control register interrupt priority registers b to j interrupt mask registers 0 to 10 interrupt mask clear registers 0 to 10 interrupt request register 0 status register i/o controller priority identifier com- parator interrupt request sr cpu bus interface internal bus interrupt contoroller i3 i2 i1 i0 (interrupt request) (interrupt request) (interrupt request) (interrupt request) (interrupt request) (interrupt request) (interrupt request) (interrupt request) (interrupt request) icr irr0 [legend] irq7 to irq0 nmi ipr imr imcr figure 10.1 block diagram of intc
section 10 interrupt controller (intc) rev. 4.00 sep. 14, 2005 page 221 of 982 rej09b0023-0400 10.2 input/output pins table 10.1 shows the intc pin configuration. table 10.1 pin configuration name abbreviation i/o description nonmaskable interrupt input pin nmi input input of interru pt request signal, not maskable by the interrupt mask bits in sr interrupt input pins irq7 to irq0 input input of interrupt request signals, maskable by the interrupt mask bits in sr 10.3 register descriptions the intc has the following registers. for details on register addresses and register states during each processing, refer to sec tion 24, list of registers. ? interrupt control register 0 (icr0) ? interrupt control register 1 (icr1) ? interrupt control register 3 (icr3) ? interrupt priority register b (iprb) ? interrupt priority register c (iprc) ? interrupt priority register d (iprd) ? interrupt priority register e (ipre) ? interrupt priority register f (iprf) ? interrupt priority register g (iprg) ? interrupt priority register h (iprh) ? interrupt priority register i (ipri) ? interrupt priority register j (iprj) ? interrupt request register 0 (irr0) ? interrupt mask register 0 (imr0) ? interrupt mask register 1 (imr1) ? interrupt mask register 2 (imr2) ? interrupt mask register 3 (imr3) ? interrupt mask register 4 (imr4) ? interrupt mask register 5 (imr5)
section 10 interrupt controller (intc) rev. 4.00 sep. 14, 2005 page 222 of 982 rej09b0023-0400 ? interrupt mask register 6 (imr6) ? interrupt mask register 7 (imr7) ? interrupt mask register 8 (imr8) ? interrupt mask register 9 (imr9) ? interrupt mask register 10 (imr10) ? interrupt mask clear register 0 (imcr0) ? interrupt mask clear register 1 (imcr1) ? interrupt mask clear register 2 (imcr2) ? interrupt mask clear register 3 (imcr3) ? interrupt mask clear register 4 (imcr4) ? interrupt mask clear register 5 (imcr5) ? interrupt mask clear register 6 (imcr6) ? interrupt mask clear register 7 (imcr7) ? interrupt mask clear register 8 (imcr8) ? interrupt mask clear register 9 (imcr9) ? interrupt mask clear register 10 (imcr10)
section 10 interrupt controller (intc) rev. 4.00 sep. 14, 2005 page 223 of 982 rej09b0023-0400 10.3.1 interrupt prio rity registers b to j (iprb to iprj) iprb to iprj are 16-bit readable/writable registers in which priority levels from 0 to 15 are set for on-chip peripheral module and irq interrupts. th ese registers are initialized to h'0000 by a power-on reset or manual reset, but are not initialized in standby mode. bit bit name initial value r/w description 15 14 13 12 ipr15 ipr14 ipr13 ipr12 0 0 0 0 r/w r/w r/w r/w these bits set the priority level for each interrupt source in 4-bit units. for details, see table 10.2, interrupt sources and iprb to iprj. 11 10 9 8 ipr11 ipr10 ipr9 ipr8 0 0 0 0 r/w r/w r/w r/w 7 6 5 4 ipr7 ipr6 ipr5 ipr4 0 0 0 0 r/w r/w r/w r/w 3 2 1 0 ipr3 ipr2 ipr1 ipr0 0 0 0 0 r/w r/w r/w r/w
section 10 interrupt controller (intc) rev. 4.00 sep. 14, 2005 page 224 of 982 rej09b0023-0400 table 10.2 interrupt sources and iprb to iprj register bits 15 to 12 bits 11 to 8 bits 7 to 4 bits 3 to 0 iprb wdt reserved * reserved * reserved * iprc irq3 irq2 irq1 irq0 iprd irq7 irq6 irq5 irq4 ipre reserved * scif0 scif1 adc0 iprf adc1 scif2 usb cmt iprg mtu0 (a/b/c/d) mtu0 (v) mtu1 (a/b) mtu1 (v/u) iprh mtu2 (a/b) mtu2 (v/u) mtu3 (a/b/c/d) mtu3 (v) ipri mtu4 (a/b/c/d) mtu4 (v) poe iic2 iprj dmac0 dmac1 dmac2 dmac3 note: * reserved: these bits are always read as 0. the write value should always be 0. as shown in table 10.2, on-chip peripheral module or irq interrupts are assigned to four 4-bit groups in each register. these 4-bit groups (bits 15 to 12, bits 11 to 8, bits 7 to 4, and bits 3 to 0) are set with values from h'0 (0000) to h'f (1111). setting of h'0 means priority level 0 (masking is requested); h'f means priority level 15 (the highest level).
section 10 interrupt controller (intc) rev. 4.00 sep. 14, 2005 page 225 of 982 rej09b0023-0400 10.3.2 interrupt cont rol register 0 (icr0) icr0 is a register that sets the input signal detection mode of external interrupt input pin nmi , and indicates the input signal level at the nmi pin. this register is initialized to h'0000 or h'8000 by a power-on reset or manual reset, bu t is not initialized in standby mode. bit bit name initial value r/w description 15 nmil 0/1 * r nmi input level sets the level of the signal in put at the nmi pin. this bit can be read from to determine the nmi pin level. this bit cannot be modified. 0: nmi input level is low 1: nmi input level is high 14 to 9 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 8 nmie 0 r/w nmi edge select selects whether the falling or rising edge of the interrupt request signal on the nmi pin is detected. 0: interrupt request is detected on falling edge of nmi input 1: interrupt request is detected on rising edge of nmi input 7 to 0 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. note: * 1 when nmi input is high, 0 when nmi input is low.
section 10 interrupt controller (intc) rev. 4.00 sep. 14, 2005 page 226 of 982 rej09b0023-0400 10.3.3 interrupt cont rol register 1 (icr1) icr1 is a 16-bit register that specifies the detection mode for external interrupt input pins irq5 to irq0 individually: rising edge, falling edge, high level, or low level. this register is initialized to h'4000 by a power-on reset or manual reset, but is not initialized in standby mode. bit bit name initial value r/w description 15 ? 0 r reserved this bit is always read as 0. the write value should always be 0. 14 irqe* 1 r/w interrupt request enable enables or disables the use of pins irq7 to irq0 as eight independent interrupt pins. 0: use of pins irq7 to irq0 as eight independent interrupt pins enabled * 1: use of pins irq7 to irq0 as interrupt pins disabled 13, 12 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 11 10 9 8 7 6 5 4 3 2 1 0 irq51s irq50s irq41s irq40s irq31s irq30s irq21s irq20s irq11s irq10s irq01s irq00s 0 0 0 0 0 0 0 0 0 0 0 0 r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w r/w irqn sense select these bits select whether interrupt request signals corresponding to pins irq5 to irq0 are detected by a rising edge, falling edge, high level, or low level. bit 2n+1 bit 2n irqn1s irqn0s 0 0 : interrupt request is detected on falling edge of irqn input 0 1 : interrupt request is detected on rising edge of irqn input 1 0 : interrupt request is detected on low level of irqn input 1 1 : interrupt request is detected on high level of irqn input n = 0 to 5 note: * the irqe bit must be cleared to 0 in the in itialization routine after a reset, and must then not be changed.
section 10 interrupt controller (intc) rev. 4.00 sep. 14, 2005 page 227 of 982 rej09b0023-0400 10.3.4 interrupt cont rol register 3 (icr3) icr3 is a 16-bit register that specifies the detection mode for external interrupt input pins irq7 and irq6 individually: rising edge, falling edge, high level, or low level. this register is initialized to h'0000 by a power-on reset or manual reset, but is not initialized in standby mode. bit bit name initial value r/w description 15 to 4 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 3 2 1 0 irq71s irq70s irq61s irq60s 0 0 0 0 r/w r/w r/w r/w irqn sense select these bits select whether interrupt request signals corresponding to pins irq7 and irq6 are detected by a rising edge, falling edge, high level, or low level. bit 2n+1 bit 2n irqn1s irqn0s 0 0 : interrupt request is detected at the falling edge of irqn input 0 1 : interrupt request is detected at the rising edge of irqn input 1 0 : interrupt request is detected on low level of irqn input 1 1 : interrupt request is detected on high level of irqn input n = 6 and 7
section 10 interrupt controller (intc) rev. 4.00 sep. 14, 2005 page 228 of 982 rej09b0023-0400 10.3.5 interrupt requ est register 0 (irr0) irr0 is an 8-bit register that indicates interrupt requests from external input pins irq7 to irq0 . this register is initialized to h'00 by a power-on reset or manual reset, but is not initialized in standby mode. bit bit name initial value r/w description 7 6 5 4 3 2 1 0 irq7r irq6r irq5r irq4r irq3r irq2r irq1r irq0r 0 0 0 0 0 0 0 0 r/w r/w r/w r/w r/w r/w r/w r/w irqn interrupt request indicates whether there is interrupt request input to the irqn pin. when edge-detection mode is set for irqn , an interrupt request is cleared by writing 0 to the irqnr bit after reading irqnr = 1. when level-detection mode is set for irqn , an interrupt request is set/cleared by only 1/0 input to the irqn pin. irqnr 0: no interrupt request input to irqn pin 1: interrupt request input to irqn pin n = 0 to 7
section 10 interrupt controller (intc) rev. 4.00 sep. 14, 2005 page 229 of 982 rej09b0023-0400 10.3.6 interrupt mask register s 0 to 10 (imr0 to imr10) imr0 to imr10 are 8-bit readable/w ritable registers that mask the irq and on-chip peripheral module interrupts. when an interrupt source is masked, interrupt requests may be mistakenly detected, depending on the operation state of the irq pins and on-chip peripheral modules. to prevent this, set imr0 to imr9 while no interrupts are set to be generated, and then read the new settings from these registers. table 10.3 shows the relationship be tween imr and each interrupt source. bit bit name initial value r/w description 7 6 5 4 3 2 1 0 im7 im6 im5 im4 im3 im2 im1 im0 0 0 0 0 0 0 0 0 r/w r/w r/w r/w r/w r/w r/w r/w interrupt mask table 10.3 lists the correspondence between the interrupt sources and interrupt mask registers. imn 1: interrupt source of the corresponding bit is masked. 0: when reading, interrupt source of the corresponding bit is not masked. when writing, no processing. n = 7 to 0
section 10 interrupt controller (intc) rev. 4.00 sep. 14, 2005 page 230 of 982 rej09b0023-0400 table 10.3 corresponden ce between interrupt sources and imr0 to imr10 bit name (function name) register name 7 6 5 4 3 2 1 0 imr0 irq7 irq6 irq5 irq4 irq3 irq2 irq1 irq0 (irq) (irq) (irq) (irq) (irq) (irq) (irq) (irq) imr1 txi0 bri0 rxi0 eri0 dei3 dei2 dei1 dei0 (scif0) (scif0) (scif0) (scif0) (dmac) (dmac) (dmac) (dmac) imr2 ? ? ? adi0 txi1 bri1 rxi1 eri1 (adc0) (adc0) (adc0) (adc0) (scif1) (scif1) (scif1) (scif1) imr4 ? ? ? ? iti ? ? ? ? ? ? ? wdt wdt wdt wdt imr5 txi2 bri2 rxi2 eri2 adi1 usihp usi1 usi0 (scif2) (scif2) (scif2) (scif2) (adc1) (usb) (usb) (usb) imr6 tci2u tci2v tgi2b tgi2 a tci1u tci1v tgi1b tgi1a (mtu2) (mtu2) (mtu2) (mtu2) (mtu1) (mtu1) (mtu1) (mtu1) imr7 ? ? ? tci0v tgi0d tgi0c tgi0b tgi0a (mtu0) (mtu0) (mtu0) (mtu0) (mtu0) (mtu0) (mtu0) (mtu0) imr8 ? ? ? tci3v tgi3d tgi3c tgi3b tgi3a (mtu3) (mtu3) (mtu3) (mtu3) (mtu3) (mtu3) (mtu3) (mtu3) imr9 ? ? ? tci4v tgi4d tgi4c tgi4b tgi4a (mtu4) (mtu4) (mtu4) (mtu4) (mtu4) (mtu4) (mtu4) (mtu4) imr10 ? ? cmi1 cmi0 iic2i ? ? oei (cmt) (cmt) (cmt) (cmt) (iic2) (iic2) (poe) (poe) note: ? : reserved: the read value is not guaranteed.
section 10 interrupt controller (intc) rev. 4.00 sep. 14, 2005 page 231 of 982 rej09b0023-0400 10.3.7 interrupt mask clear regist ers 0 to 10 (imcr0 to imcr10) imcr0 to imcr10 are 8-bit writable register s that clear the mask settings for the irq and on- chip peripheral module interrupts. table 10.4 shows th e relationship between imcr and each interrupt source. bit bit name initial value r/w description 7 6 5 4 3 2 1 0 imc7 imc6 imc5 imc4 imc3 imc2 imc1 imc0 ? ? ? ? ? ? ? ? w w w w w w w w interrupt mask clear table 10.4 lists the correspondence between the interrupt sources and interrupt mask clear registers. imcn (write) 1: the corresponding bit in interrupt mask register imcn is cleared 0: no processing n = 7 to 0
section 10 interrupt controller (intc) rev. 4.00 sep. 14, 2005 page 232 of 982 rej09b0023-0400 table 10.4 corresponden ce between interrupt sour ces and imcr0 to imcr10 bit name (function name) register name 7 6 5 4 3 2 1 0 imcr0 irq7 irq6 irq5 irq4 irq3 irq2 irq1 irq0 (irq) (irq) (irq) (irq) (irq) (irq) (irq) (irq) imcr1 txi0 bri0 rxi0 eri0 dei3 dei2 dei1 dei0 (scif0) (scif0) (scif0) (scif0) (dmac) (dmac) (dmac) (dmac) imcr2 ? ? ? adi0 txi1 bri1 rxi1 eri1 (adc0) (adc0) (adc0) (adc0) (scif1) (scif1) (scif1) (scif1) imcr4 ? ? ? ? iti ? ? ? ? ? ? ? (wdt) (wdt) (wdt) (wdt) imcr5 txi2 bri2 rxi2 eri2 adi1 usihp usi1 usi0 (scif2) (scif2) (scif2) (scif2) (adc1) (usb) (usb) (usb) imcr6 tci2u tci2v tgi2b tgi2 a tci1u tci1v tgi1b tgi1a (mtu2) (mtu2) (mtu2) (mtu2) (mtu1) (mtu1) (mtu1) (mtu1) imcr7 ? ? ? tci0v tgi0d tgi0c tgi0b tgi0a (mtu0) (mtu0) (mtu0) (mtu0) (mtu0) (mtu0) (mtu0) (mtu0) imcr8 ? ? ? tci3v tgi3d tgi3c tgi3b tgi3a (mtu3) (mtu3) (mtu3) (mtu3) (mtu3) (mtu3) (mtu3) (mtu3) imcr9 ? ? ? tci4v tgi4d tgi4c tgi4b tgi4a (mtu4) (mtu4) (mtu4) (mtu4) (mtu4) (mtu4) (mtu4) (mtu4) imcr10 ? ? cmi1 cmi0 iic2i ? ? oei (cmt) (cmt) (cmt) (cmt) (iic2) (iic2) (poe) (poe) note: ? : reserved: these bits are always read as 0. the write value should always be 0.
section 10 interrupt controller (intc) rev. 4.00 sep. 14, 2005 page 233 of 982 rej09b0023-0400 10.4 interrupt sources there are four types of interrupt sources: nmi, h-udi, irq, and on-chip peripheral modules. each interrupt has a priority level (0 to 16), with 1 the lowest and 16 the highest. priority level 0 masks an interrupt, so the interrupt request is ignored. 10.4.1 nmi interrupt the nmi interrupt has the highest priority level of 16. when the bl bit in the status register (sr) is 0, nmi interrupts are accepted. nmi interrupts are edge-detected. in slee p or standb y mode, the interrupt is accepted regardless of the bl setting. the nmi edge select bit (nmie) in the interrupt control register 0 (icr0) is used to select either rising or falling edge detection. when using edge-input detection for nmi interrupts, a pulse width of at least two p cycles (peripheral clock) is necessary. nmi interrupt exception handling does not affect the interrupt mask level bits (i3 to i0) in the status register (sr). it is possible to wake the chip up from sleep mode or standby mode with an nmi interrupt. 10.4.2 h-udi interrupt the h-udi interrupt is accepted between one inst ruction and another when the h-udi interrupt command (section 15.4.5, h-udi interrupt.) is ente red, the sr interrupt mask bit is set to the value smaller than 15, and the bl bit in sr is set to 0. the h-udi interrupt allows the pc to be sa ved to the spc immediately after accepting the interrupt instruction. the sr at the time of th e interrupt acceptation is saved to the ssr. the intevt2 is set to h'5e0. the bl and rb bits in sr are set to 1 and branched to vbr + h'0600. 10.4.3 irq interrupts irq interrupts are input by level or edge from pins irq7 to irq0 . the priority can be set by interrupt priority registers c and d (iprc and iprd) in a range from 0 to 15. when using edge-sensing for irq interrupts, clear the interrupt source by having software read 1 from the corresponding bit in irr0, then write 0 to the bit. when icr1 and icr3 are overwritten, irq interrupts may be mistakenly detected, depending on the irq pin level. to prevent this, overwrite the regi ster while interrupts ar e masked, then release the mask after clearing the illegal interrupt by writing 0 to interrupt request register 0 (irr0).
section 10 interrupt controller (intc) rev. 4.00 sep. 14, 2005 page 234 of 982 rej09b0023-0400 edge input interrupt detection requires input of a pulse width of more than two cycles on a p clock basis. when using level-sensing for irq interrupts, the pin levels must be retained until the cpu samples the pins. therefore, the interrupt source must be cleared by the interrupt handler. the interrupt mask bits (i3 to i0) in the status register (sr) are not affected by irq interrupt handling. 10.4.4 on-chip peripheral module interrupts on-chip peripheral module interrupts are generated by the following 9 modules: ? dma controller (dmac) ? serial communication interf aces (scif0 to scif2) ? a/d converters (adc0 and adc1) ? compare match timers (cmt0 and cmt1) ? usb function module (usb) ? multifunction timer pulse units (mtu0 to mtu4) ? watchdog timer (wdt) ? user debugging interface (h-udi) ? i 2 c bus interface 2 (iic2) not every interrupt source is assigned a different interrupt vector. sources are reflected in the interrupt event register (intevt2). it is easy to identify sources by using the value of the intevt2 register as a branch offset. a priority level (from 0 to 15) can be set for each module except h-udi by writing to interrupt priority registers b to j (iprb to iprj). the prio rity level of the h-udi in terrupt is 15 (fixed). the interrupt mask bits (i3 to i0) in the status register are not affected by on-chip peripheral module interrupt handling.
section 10 interrupt controller (intc) rev. 4.00 sep. 14, 2005 page 235 of 982 rej09b0023-0400 10.4.5 interrupt exceptio n handling and priority there are three types of interrupt sources: nmi, irq, and on-chip peripheral modules. the priority of each interrupt source is set within level 0 to level 16; level 16 is the highest and level 1 is the lowest. when the priority is set to level 0, that interrupt is masked and the interrupt request is ignored. table 10.5 lists the codes for the interrupt event register (intevt2) and the order of interrupt priority. each interrupt source is assigned a unique code by intevt2. the start address of the interrupt service routine is common for each interrupt source. this is wh y, for instance, the value of intevt2 is used as an offset at the start of the interrupt service routine and branched to in order to identify the interrupt source. irq interrupt and on-chip peripheral module interrupt priorities can be set freely between 0 and 15 for each module by setting interrupt priority regi sters a to j (ipra to iprj). a reset assigns priority level 0 to irq and on-chip peripheral module interrupts. if the same priority level is assigned to two or more interrupt sources and interrupts from those sources occur simultaneously, their priority order is the default priority order indicated at the right in table 10.5.
section 10 interrupt controller (intc) rev. 4.00 sep. 14, 2005 page 236 of 982 rej09b0023-0400 table 10.5 interrupt exception handling sources and priority interrupt source exception code interrupt priory (initial value) ipr (bit number) priority within ipr setting unit default priority nmi h'1c0 16 ? ? high h-udi interrupt h'5e0 15 ? ? irq irq0 h'600 0 to 15 (0) iprc (3 to 0) ? irq1 h'620 0 to 15 (0) iprc (7 to 4) ? irq2 h'640 0 to 15 (0) iprc (11 to 8) ? irq3 h'660 0 to 15 (0) iprc (15 to 12) ? irq4 h'680 0 to 15 (0) iprd (3 to 0) ? irq5 h'6a0 0 to 15 (0) iprd (7 to 4) ? irq6 h'6c0 0 to 15 (0) iprd (11 to 8) ? irq7 h'6e0 0 to 15 (0) iprd (15 to 12) ? dmac0 dei0 h'800 0 to 15 (0) iprj (15 to 12) ? dmac1 dei1 h'820 0 to 15 (0) iprj (11 to 8) ? dmac2 dei2 h'840 0 to 15 (0) iprj (7 to 4) ? dmac3 dei3 h'860 0 to 15 (0) iprj (3 to 0) ? scif0 eri0 h'880 0 to 15 (0) ipre (11 to 8) high rxi0 h'8a0 bri0 h'8c0 txi0 h'8e0 low scif1 eri1 h'900 0 to 15 (0) ipre (7 to 4) high rxi1 h'920 bri1 h'940 txi1 h'960 low adc adi0 h'980 0 to 15 (0) ipre (3 to 0) high adi1 h'9a0 iprf (15 to 12) low usb usi0 h'a00 0 to 15 (0) iprf (7 to 4) high usi1 h'a20 usihp h'a40 low low
section 10 interrupt controller (intc) rev. 4.00 sep. 14, 2005 page 237 of 982 rej09b0023-0400 interrupt source exception code interrupt priory (initial value) ipr (bit number) priority within ipr setting unit default priority mtu0 tgi0a h'a80 0 to 15 (0) iprg (15 to 12) high high tgi0b h'aa0 tgi0c h'ac0 tgi0d h'ae0 low tci0v h'b00 iprg (11 to 8) ? mtu1 tgi1a h'c00 0 to 15 (0) iprg (7 to 4) high tgi1b h'c20 low tci1v h'c40 iprg (3 to 0) high tci1u h'c60 low mtu2 tgi2a h'c80 0 to 15 (0) iprh (15 to 12) high tgi2b h'ca0 low tci2v h'cc0 iprh (11 to 8) high tci2u h'ce0 low mtu3 tgi3a h'd00 0 to 15 (0) iprh (7 to 4) high tgi3b h'd20 tgi3c h'd40 tgi3d h'd60 low tci3v h'd80 iprh (3 to 0) ? mtu4 tgi4a h'e00 0 to 15 (0) ipri (15 to 12) high tgi4b h'e20 tgi4c h'e40 tgi4d h'e60 low tci4v h'e80 ipri (11 to 8) ? cmt cmi0 h'f00 0 to 15 (0) iprf (3 to 0) high cmi1 h'f20 low scif2 eri2 h'400 0 to 15 (0) iprf (11 to 8) high rxi2 h'420 bri2 h'440 txi2 h'460 low poe oei h'480 0 to 15 (0) ipri (7 to 4) ? iic2 iic2i h'f40 0 to 15 (0) ipri (3 to 0) ? wdt iti h'560 0 to 15 (0) iprb (15 to 12) ? low
section 10 interrupt controller (intc) rev. 4.00 sep. 14, 2005 page 238 of 982 rej09b0023-0400 10.5 intc operation 10.5.1 interrupt sequence the sequence of interrupt operations is described below. figure 10.2 is a flowchart of the operations. 1. the interrupt request sources send interrupt request signals to the interrupt controller. 2. the interrupt controller selects the highest-prio rity interrupt from the interrupt requests sent, following the priority levels set in interrupt pr iority registers b to j (iprb to iprj). lower priority interrupts are held pending. if two of thes e interrupts have the same priority level or if multiple interrupts occur within a single module, the interrupt with the highest priority is selected, according to table 10.5. 3. the priority level of the interrupt selected by the interrupt controller is compared with the interrupt mask bits (i3 to i0) in the status register (sr) of the cpu. if the request priority level is higher than the level in bits i3 to i0, th e interrupt controller accept s the interrupt and sends an interrupt request signal to the cpu. 4. detection timing: the intc operates, and notifies the cpu of interrupt requests, in synchronization with the peripheral clock (p ). the cpu receives an interrupt at a break in instructions. 5. the interrupt source code is set in the interrupt event register (intevt2). 6. the status register (sr) and program counter (pc) are saved to ssr and spc, respectively. 7. the block bit (bl) and register bank bit (rb) in sr are set to 1. 8. the cpu jumps to the start address of the interrupt handler (the sum of the value set in the vector base register (vbr) and h'00000600). this jump is not a delayed branch. the interrupt handler may branch with the intevt2 register value as its offset in order to identify the interrupt source. this enables it to branch to the handling routine for the individual interrupt source. notes: 1. the interrupt mask bits (i3 to i0) in the status register (sr) are not changed by acceptance of an interr upt in this lsi. 2. the interrupt source flag should be cleared in the interrupt handler. to ensure that an interrupt request that should have been clear ed is not inadvertently accepted again, read the interrupt source flag after it has been cl eared, and then execute an rte instruction.
section 10 interrupt controller (intc) rev. 4.00 sep. 14, 2005 page 239 of 982 rej09b0023-0400 i3 to i0: interrupt mask bits in status register (sr) program execution state interrupt generated? sr.bl=0 or sleep mode? yes yes yes yes yes yes yes yes yes no no no no no no no no no nmi? level 15 interrupt? set interrupt sourse in intevt2 save sr to ssr; save pc to spc set bl/rb bits in sr to1 branch to exception handler i3 to i0 level 14or lower? level 14 interrupt? i3 to i0 level 13 or lower? level 1 interrupt? i3 to i0 level 0? figure 10.2 interrupt operation flowchart
section 10 interrupt controller (intc) rev. 4.00 sep. 14, 2005 page 240 of 982 rej09b0023-0400 10.5.2 multiple interrupts when handling multiple interrupts, an interrupt handler should include the following procedures: 1. branch to a specific interrupt handler corresponding to a code set in intevt2. the code in intevt2 can be used as an offset for branching to the specific handler. 2. clear the interrupt source in each specific handler. 3. save ssr and spc to memory. 4. clear the bl bit in sr, and set the accepted inte rrupt level in the interrupt mask bits in sr. 5. handle the interrupt. 6. execute the rte instruction. when these procedures are followed in order, an interrupt of high er priority than the one being handled can be accepted after clearing bl in step 4. figure 10.2 shows a sample interrupt operation flowchart. 10.6 notes on use 10.6.1 notes on usb bus power control use irq0 / irq1 carefully. the usb bus power control uses the interrupt control logic block for irq0 / irq1 . for the details about the usb bus power control, refer to section 20, usb function module. 10.6.2 timing to clear an interrupt source as described in section 10.5.1, interrupt sequence, clear the interrupt source flags in the interrupt handler. to avoid accepting an interrupt source flag that ha s been cleared, read the flag and then, execute the rte instruction.
section 11 user break controller (ubc) rev. 4.00 sep. 14, 2005 page 241 of 982 rej09b0023-0400 section 11 user break controller (ubc) the user break controller (ubc) provides functions that simplify program debugging. these functions make it easy to design an effective self-monitoring debugger, enabling the chip to debug programs without using an in-circuit emulator. break conditions that can be set in the ubc are instruction fetch or data read/write access, data si ze, data contents, address value, and stop timing in the case of instruction fetch. 11.1 features the ubc has the following features: 1. the following break comparison conditions can be set. number of break channels: two channels (channels a and b) user break can be requested as either the independent or sequential condition on channels a and b (sequential break setting: channel a and then channel b match with break conditions, but not in the same bus cycle). ? address comparison bits are maskable in 1-bit units. one of the four address buses (logic address bus (lab), internal address bus (iab), x-memory address bus (xab), and y-memory address bus (yab)) can be selected. ? data only on channel b, 32-bit maskable. one of the four data buses (l-bus data (ldb), i-bus data (idb), x-memory data bus (xdb) and y-memory data bus (ydb)) can be selected. ? bus cycle instruction fetch or data access ? read/write ? operand size byte, word, and longword 2. a user-designed user-break condition exception processing routine can be run. 3. in an instruction fetch cycle, it can be selected that a break is set before or after an instruction is executed. 4. maximum repeat times for the break condition (only for channel b): 2 12 ? 1 times. 5. eight pairs of branch source/destination buffers.
section 11 user break controller (ubc) rev. 4.00 sep. 14, 2005 page 242 of 982 rej09b0023-0400 figure 11.1 shows a block diagram of the ubc. bbra bara bamra cpu state signals xab/yab iab lab internal bus access comparator address comparator channel a access comparator address comparator data comparator pc trace control channel b bbrb betr basra basrb barb bamrb bbrb bdmrb brsr brdr brcr user break request ubc location ccn location ldb/idb/ xdb/ydb [legend] bbra: bara: bamra: basra: bbrb: barb: bamrb: basrb: bdrb: bdmrb: betr: brsr: brdr: brcr: break bus cycle register a break address register a break address mask register a break asid register a break bus cycle register b break address register b break address mask register b break asid register b break data register b break data mask register b break execution times register branch source register branch destination register break control register access control asid comparator asid comparator asid figure 11.1 block diagra m of user break controller
section 11 user break controller (ubc) rev. 4.00 sep. 14, 2005 page 243 of 982 rej09b0023-0400 11.2 register descriptions the user break controller has the following regist ers. for details on register addresses and access sizes, refer to section 24, list of registers. ? break address register a (bara) ? break address mask register a (bamra) ? break bus cycle register a (bbra) ? break address register b (barb) ? break address mask register b (bamrb) ? break bus cycle register b (bbrb) ? break data register b (bdrb) ? break data mask register b (bdmrb) ? break control register (brcr) ? execution times break register (betr) ? branch source register (brsr) ? branch destination register (brdr) 11.2.1 break address register a (bara) bara is a 32-bit readable/writable register. bara specifies the address used as a break condition in channel a. bit bit name initial value r/w description 31 to 0 baa31 to baa0 all 0 r/w break address a store the address on the la b or iab specifying break conditions of channel a.
section 11 user break controller (ubc) rev. 4.00 sep. 14, 2005 page 244 of 982 rej09b0023-0400 11.2.2 break address ma sk register a (bamra) bamra is a 32-bit readable/writable register. bamr a specifies bits masked in the break address specified by bara. bit bit name initial value r/w description 31 to 0 bama31 to bama0 all 0 r/w break address mask a specify bits masked in the channel a break address bits specified by bara (baa31 to baa0). 0: break address bit baan of channel a is included in the break condition 1: break address bit baan of channel a is masked and is not included in the break condition note: n = 31 to 0 11.2.3 break bus cycl e register a (bbra) break bus cycle register a (bbra) is a 16-bit read able/writable register, which specifies (1) l bus cycle or i bus cycle, (2) instruc tion fetch or data access, (3) read or write, and (4) operand size in the break conditions of channel a. bit bit name initial value r/w description 15 to 8 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 7 6 cda1 cda0 0 0 r/w r/w l bus cycle/i bus cycle select a select the l bus cycle or i bus cycle as the bus cycle of the channel a break condition. 00: condition comparison is not performed 01: the break condition is the l bus cycle 10: the break condition is the i bus cycle 11: the break condition is the l bus cycle
section 11 user break controller (ubc) rev. 4.00 sep. 14, 2005 page 245 of 982 rej09b0023-0400 bit bit name initial value r/w description 5 4 ida1 ida0 0 0 r/w r/w instruction fetch/data access select a select the instruction fetch cycle or data access cycle as the bus cycle of the c hannel a break condition. 00: condition comparison is not performed 01: the break condition is the instruction fetch cycle 10: the break condition is the data access cycle 11: the break condition is the instruction fetch cycle or data access cycle 3 2 rwa1 rwa0 0 0 r/w r/w read/write select a select the read cycle or write cycle as the bus cycle of the channel a break condition. 00: condition comparison is not performed 01: the break condition is the read cycle 10: the break condition is the write cycle 11: the break condition is the read cycle or write cycle 1 0 sza1 sza0 0 0 r/w r/w operand size select a select the operand size of the bus cycle for the channel a break condition. 00: the break condition does not include operand size 01: the break condition is byte access 10: the break condition is word access 11: the break condition is longword access
section 11 user break controller (ubc) rev. 4.00 sep. 14, 2005 page 246 of 982 rej09b0023-0400 11.2.4 break addres s register b (barb) barb is a 32-bit readable/writable register. barb sp ecifies the address used as a break condition in channel b. control bits cdb1, cdb0, xye, and xys in bbrb select one of the four address buses for break condition b. bit bit name initial value r/w description 31 to 0 bab31 to bab0 all 0 r/w break address b store an address which specifies a break condition in channel b. if the i bus or l bus is selected in bbrb, an iab or lab address is set in bab31 to bab0. if the x memory is selected in bbrb, the values in bits 15 to 1 in xab are set in bab31 to bab17. in this case, the values in bab16 to bab0 are arbitrary. if the y memory is selected in bbrb, the values in bits 15 to 1 in yab are set in bab15 to bab1. in this case, the values in bab31 to bab16 are arbitrary. table 11.1 specifying break address register bus selection in bbrb bab31 to bab17 bab16 bab15 to bab1 bab0 l bus lab31 to lab0 i bus iab31 to iab0 x bus xab15 to xab1 don't care don't care don't care y bus don't care don't care yab15 to yab1 don't care
section 11 user break controller (ubc) rev. 4.00 sep. 14, 2005 page 247 of 982 rej09b0023-0400 11.2.5 break address ma sk register b (bamrb) bamrb is a 32-bit readable/writable register. bam rb specifies bits masked in the break address specified by barb. bit bit name initial value r/w description 31 to 0 bamb31 to bamb0 all 0 r/w break address mask b specify bits masked in the break address of channel b specified by barb (bab31 to bab0). 0: break address babn of channel b is included in the break condition 1: break address babn of channel b is masked and is not included in the break condition note: n = 31 to 0 11.2.6 break data register b (bdrb) bdrb is a 32-bit readable/writable register. the control bits cdb1, cdb0, xye, and xys in bbrb select one of the four data buses for break condition b. bit bit name initial value r/w description 31 to 0 bdb31 to bdb0 all 0 r/w break data bit b store data which specifies a break condition in channel b. if the i bus is selected in bbrb, the break data on idb is set in bdb31 to bdb0. if the l bus is selected in bbrb, the break data on ldb is set in bdb31 to bdb0. if the x memory is selected in bbrb, the break data in bits 15 to 0 in xdb is set in bdb31 to bdb16. in this case, the values in bdb15 to bdb0 are arbitrary. if the y memory is selected in bbrb, the break data in bits 15 to 0 in ydb are set in bdb15 to bdb0. in this case, the values in bdb31 to bdb16 are arbitrary.
section 11 user break controller (ubc) rev. 4.00 sep. 14, 2005 page 248 of 982 rej09b0023-0400 table 11.2 specifying break data register bus selection in bbrb bdb31 to bdb16 bdb15 to bdb0 l bus ldb31 or ldb0 i bus idb31 to idb0 x bus xdb15 to xdb0 don't care y bus don't care ydb15 to ydb0 notes: 1. specify an operand size when including t he value of the data bus in the break condition. 2. when the byte size is selected as a break condition, the same byte data must be set in bits 15 to 8 and 7 to 0 in bdrb as the break data. 3. set the data in bits 31 to 16 when includin g the value of the data bus as an l-bus break condition for the movs.w @-as,ds, mo vs.w @as,ds, movs.w @as+,ds, or movs.w @as+ix,ds instruction. 11.2.7 break data mask register b (bdmrb) bdmrb is a 32-bit readable/writable register. bd mrb specifies bits masked in the break data specified by bdrb. bit bit name initial value r/w description 31 to 0 bdmb31 to bdmb0 all 0 r/w break data mask b specify bits masked in the break data of channel b specified by bdrb (bdb31 to bdb0). 0: break data bdbn of channel b is included in the break condition 1: break data bdbn of channel b is masked and is not included in the break condition note: n = 31 to 0 notes: 1. specify an operand size when including t he value of the data bus in the break condition. 2. when the byte size is selected as a break condition, the same byte data must be set in bits 15 to 8 and 7 to 0 in bdrb as the break mask data in bdmrb. 3. set the mask data in bits 31 to 16 when in cluding the value of the data bus as an l-bus break condition for the movs.w @-as,ds, movs.w @as,ds, movs.w @as+,ds, or movs.w @as+ix,ds instruction.
section 11 user break controller (ubc) rev. 4.00 sep. 14, 2005 page 249 of 982 rej09b0023-0400 11.2.8 break bus cycl e register b (bbrb) break bus cycle register b (bbrb) is a 16-bit read able/writable register, which specifies (1) x bus or y bus, (2) l bus cycle or i bus cycle, (3) inst ruction fetch or data access, (4) read or write, and (5) operand size in the break conditions of channel b. bit bit name initial value r/w description 15 to 10 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 9 xye 0 r/w selects the x memory bus or y memory bus as the channel b break condition. note that this bit setting is enabled only when the l bus is selected with the cdb1 and cdb0 bits. selection between the x memory bus and y memory bus is done by the xys bit. 0: selects l bus for the channel b break condition unconditionally 1: selects x/y memory bus for the channel b break condition 8 xys 0 r/w selects the x bus or the y bus as the bus of the channel b break condition. 0: selects the x bus for the channel b break condition 1: selects the y bus for the channel b break condition 7 6 cdb1 cdb0 0 0 r/w r/w l bus cycle/i bus cycle select b select the l bus cycle or i bus cycle as the bus cycle of the channel b break condition. 00: condition comparison is not performed 01: the break condition is the l bus cycle 10: the break condition is the i bus cycle 11: the break condition is the l bus cycle
section 11 user break controller (ubc) rev. 4.00 sep. 14, 2005 page 250 of 982 rej09b0023-0400 bit bit name initial value r/w description 5 4 idb1 idb0 0 0 r/w r/w instruction fetch/data access select b select the instruction fetch cycle or data access cycle as the bus cycle of the c hannel b break condition. 00: condition comparison is not performed 01: the break condition is the instruction fetch cycle 10: the break condition is the data access cycle 11: the break condition is the instruction fetch cycle or data access cycle 3 2 rwb1 rwb0 0 0 r/w r/w read/write select b select the read cycle or write cycle as the bus cycle of the channel b break condition. 00: condition comparison is not performed 01: the break condition is the read cycle 10: the break condition is the write cycle 11: the break condition is the read cycle or write cycle 1 0 szb1 szb0 0 0 r/w r/w operand size select b select the operand size of the bus cycle for the channel b break condition. 00: the break condition does not include operand size 01: the break condition is byte access 10: the break condition is word access 11: the break condition is longword access
section 11 user break controller (ubc) rev. 4.00 sep. 14, 2005 page 251 of 982 rej09b0023-0400 11.2.9 break control register (brcr) brcr sets the following conditions: 1. channels a and b are used in two independent channel conditions or under the sequential condition. 2. a break is set before or after instruction execution. 3. specify whether to include the number of execution times on channel b in comparison conditions. 4. determine whether to include data bus on channel b in comparison conditions. 5. enable pc trace. the break control register (brcr) is a 32-bit read able/writable register that has break conditions match flags and bits for setting a variety of break conditions. bit bit name initial value r/w description 31 to 16 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 15 scmfca 0 r/w l bus cycle condition match flag a when the l bus cycle condition in the break conditions set for channel a is satisfied, this flag is set to 1 (not cleared to 0). in order to clea r this flag, write 0 into this bit. 0: the l bus cycle conditio n for channel a does not match 1: the l bus cycle conditio n for channel a matches 14 scmfcb 0 r/w l bus cycle condition match flag b when the l bus cycle condition in the break conditions set for channel b is satisfied, this flag is set to 1 (not cleared to 0). in order to clea r this flag, write 0 into this bit. 0: the l bus cycle conditio n for channel b does not match 1: the l bus cycle conditio n for channel b matches
section 11 user break controller (ubc) rev. 4.00 sep. 14, 2005 page 252 of 982 rej09b0023-0400 bit bit name initial value r/w description 13 scmfda 0 r/w i bus cycle condition match flag a when the i bus cycle condition in the break conditions set for channel a is satisfied, this flag is set to 1 (not cleared to 0). in order to clea r this flag, write 0 into this bit. 0: the i bus cycle condition for channel a does not match 1: the i bus cycle condition for channel a matches 12 scmfdb 0 r/w i bus cycle condition match flag b when the i bus cycle condition in the break conditions set for channel b is satisfied, this flag is set to 1 (not cleared to 0). in order to clea r this flag, write 0 into this bit. 0: the i bus cycle condition for channel b does not match 1: the i bus cycle condition for channel b matches 11 pcte 0 r/w pc trace enable 0: disables pc trace 1: enables pc trace 10 pcba 0 r/w pc break select a selects the break timing of the instruction fetch cycle for channel a as before or after instruction execution. 0: pc break of channel a is set before instruction execution 1: pc break of channel a is set after instruction execution 9, 8 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 7 dbeb 0 r/w data break enable b selects whether or not the data bus condition is included in the break condition of channel b. 0: no data bus condition is included in the condition of channel b 1: the data bus condition is included in the condition of channel b
section 11 user break controller (ubc) rev. 4.00 sep. 14, 2005 page 253 of 982 rej09b0023-0400 bit bit name initial value r/w description 6 pcbb 0 r/w pc break select b selects the break timing of the instruction fetch cycle for channel b as before or after instruction execution. 0: pc break of channel b is set before instruction execution 1: pc break of channel b is set after instruction execution 5, 4 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 3 seq 0 r/w sequence condition select selects two conditions of channels a and b as independent or sequential conditions. 0: channels a and b are compared under independent conditions 1: channels a and b are compared under sequential conditions (channel a, then channel b) 2, 1 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 0 etbe 0 r/w number of execution times break enable enables the execution-times break condition only on channel b. if this bit is 1 (break enable), a user break is issued when the number of break conditions matches with the number of execution ti mes that is specified by betr. 0: the execution-times break condition is disabled on channel b 1: the execution-times break condition is enabled on channel b
section 11 user break controller (ubc) rev. 4.00 sep. 14, 2005 page 254 of 982 rej09b0023-0400 11.2.10 execution times break register (betr) betr is a 16-bit readable/writable register. when the execution-times break condition of channel b is enabled, this register specifies the numb er of execution times to make the break. the maximum number is 2 12 ? 1 times. when a break condition is satisfied, it decreases betr. a break is issued when the break condition is satisfied after betr becomes h'0001. bit bit name initial value r/w description 15 to 12 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 11 to 0 bet11 to bet0 all 0 r/w number of execution times 11.2.11 branch source register (brsr) brsr is a 32-bit read-only register. brsr stores bits 27 to 0 in the address of the branch source instruction. brsr has the flag bit that is set to 1 when a branch occurs. this flag bit is cleared to 0 when brsr is read, the setting to enable pc trace is made, or brsr is initialized by a power-on reset. other bits are not initialized by a power-o n reset. the eight brsr registers have a queue structure and a stored register is shifted at every branch. bit bit name initial value r/w description 31 svf 0 r brsr valid flag indicates whether the branch source address is stored. when a branch source address is fetched, this flag is set to 1. this flag is cleared to 0 by reading from brsr. 0: the value of brsr register is invalid 1: the value of brsr register is valid 30 to 28 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 27 to 0 bsa27 to bsa0 ? r branch source address store bits 27 to 0 of the branch source address.
section 11 user break controller (ubc) rev. 4.00 sep. 14, 2005 page 255 of 982 rej09b0023-0400 11.2.12 branch destination register (brdr) brdr is a 32-bit read-only register. brdr stores bits 27 to 0 in the address of the branch destination instruction. brdr has the flag bit that is set to 1 when a branch occurs. this flag bit is cleared to 0 when brdr is read, the setting to enab le pc trace is made, or brdr is initialized by a power-on reset. other bits are not initialized by a power-on reset. the eight brdr registers have a queue structure and a stored register is shifted at every branch. bit bit name initial value r/w description 31 dvf 0 r brdr valid flag indicates whether a branch destination address is stored. when a branch destin ation address is fetched, this flag is set to 1. this flag is cleared to 0 by reading brdr. 0: the value of brdr register is invalid 1: the value of brdr register is valid 30 to 28 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 27 to 0 bda27 to bda0 ? r branch destination address store bits 27 to 0 of the branch destination address.
section 11 user break controller (ubc) rev. 4.00 sep. 14, 2005 page 256 of 982 rej09b0023-0400 11.3 operation 11.3.1 flow of the user break operation the flow from setting of break conditions to user break exception processing is described below: 1. the break addresses is set in the break address registers (bara or barb). the masked addresses are set in th e break address mask registers (bam ra or bamrb). the break data is set in the break data register (bdrb). the masked data is set in the break data mask register (bdmrb). the bus break conditions are set in the break bus cycle registers (bbra or bbrb). three groups of bbra or bbrb (l bus cycle/i bus cycle select, instruction fetch/data access select, and read/write select) are each set. no user break will be generated if even one of these groups is set with 00. the re spective conditions are set in the bits of the break control register (brcr). make sure to set all registers related to breaks before setting bbra or bbrb. 2. when the break conditions are satisfied, the ubc sends a user break request to the cpu and sets the l bus condition match flag (scmfca or scmfcb) and the i bus condition match flag (scmfda or scmfdb) for the appropriat e channel. when the x/y memory bus is specified for channel b, scmfcb is used for the condition match flag. 3. the appropriate condition match flags (s cmfca, scmfda, scmfcb, and scmfdb) can be used to check if the set conditions match or no t. the matching of the conditions sets flags, but they are not reset. 0 must first be written to them before they can be used again. 4. there is a chance that the break set in channe l a and the break set in channel b occur around the same time. in this case, there will be onl y one break request to the cpu, but these two break channel match flags could be both set. 5. when selecting the i bus as the break condition, note the following: ? several bus masters, including the cpu and dmac, are connected to the i bus. the ubc monitors bus cycles generated by all bus masters, and determines the condition match. ? physical addresses are used for the i bus. set a physical address in break address registers (bara and barb). the upper three bits of logi cal addresses in the p0 to p3 area issued by the cpu on the l bus are masked (to 0) be fore they are placed on the i bus. the upper three bits of the source and destination addre sses set in the dmac are masked in the same way. however, logical addresses in the p4 area are output unchanged on the i bus. ? for data access cycles issued on the l bus by th e cpu, if their logical addresses are not to be cached, they are issued with th e data size specified on the l bus. ? for instruction fetch cycles issued on the l bus by the cpu, even though their logical addresses are not to be cache d, they are issued in longwords and their addresses are rounded to match longword boundaries.
section 11 user break controller (ubc) rev. 4.00 sep. 14, 2005 page 257 of 982 rej09b0023-0400 ? if a logical address issued on the l bus by th e cpu is an address to be cached and a cache miss occurs, its bus cycle is issued as a cache fill cycle on the i bus. in this case, it is issued in longwords and its address is rounded to match longword boundaries. however note that cache fill is not performed for a write miss in write through mode. in this case, the bus cycle is issued with the data size specified on the l bus and it s address is not rounded. in write back mode, a write back cycle may be issued in addition to a read fill cycle. it is a longword bus cycle whose address is rounded to match longword boundaries. ? i bus cycles (including read fill cycles) resulting from instruction fetches on the l bus by the cpu are defined as instruction fetch cycles on the i bus, while other bus cycles are defined as data access cycles. ? the dmac only issues data access cycles for i bus cycles. ? if a break condition is specified for the i bus, even when the condition matches in an i bus cycle resulting from an instruction executed by the cpu, at which instruction the break is to be accepted cannot be clearly defined. 6. while the block bit (bl) in the cpu status register (sr) is set to 1, no breaks can be accepted. however, condition determination will be carr ied out, and if the condition matches, the corresponding condition match flag is set to 1. 11.3.2 break on inst ruction fetch cycle 1. when l bus/instruction fetch/read/word or lo ngword is set in the break bus cycle register (bbra or bbrb), the break condition becomes the l bus instruction fetch cycle. whether it breaks before or after the execution of the instruction can then be sel ected with the pcba or pcbb bit of the break control regi ster (brcr) for the appropriate channel. if an instruction fetch cycle is set as a break condition, clear lsb in the break address register (bara or barb) to 0. a break cannot be generated as long as this bit is set to 1. 2. an instruction set for a break before execution breaks when it is confirmed that the instruction has been fetched and will be executed. this means this feature cannot be used on instructions fetched by overrun (instructions fetched at a branch or during an interrupt transition, but not to be executed). when this kind of break is set for the delay slot of a delayed branch instruction, the break is generated prior to execution of the delayed branch instruction. note: if a branch does not occur at a delay condition branch instruction, the subsequent instruction is not recognized as a delay slot. 3. when the condition is specified to be occurred after execution, the instruction set with the break condition is executed and then the break is generated prior to the execution of the next instruction. as with pre-execution breaks, this cannot be used with overrun fetch instructions. when this kind of break is set for a delayed branch instruction and its delay slot, a break is not generated until the first instruction at the branch destination.
section 11 user break controller (ubc) rev. 4.00 sep. 14, 2005 page 258 of 982 rej09b0023-0400 4. when an instruction fetch cycle is set for channel b, the break data register b (bdrb) is ignored. therefore, break data cannot be set for the break of the instruction fetch cycle. 5. if the i bus is set for a break of an instructi on fetch cycle, the condition is determined for the instruction fetch cycles on the i bus. for details, see 5 in section 11.3.1, flow of the user break operation. 11.3.3 break on data access cycle 1. if the l bus is specified as a break conditi on for data access break, c ondition comparison is performed for the logical addresses (and data ) accessed by the executed instructions, and a break occurs if the condition is satisfied. if the i bus is specified as a break condition, condition comparison is performed for the physical addresses (and data) of the data access cycles that are issued on the i bus by all bus masters including the cpu, and a break occurs if the condition is satisfied. for details on the cpu bus cycles issued on the i bus, see 5 in section 11.3.1, flow of the user break operation. 2. the relationship between the data access cycle address and the comparison condition for each operand size is listed in table 11.3. table 11.3 data access cycle addresses and operand size comparison conditions access size address compared longword compares break address register bits 31 to 2 to address bus bits 31 to 2 word compares break address register bits 31 to 1 to address bus bits 31 to 1 byte compares break address register bits 31 to 0 to address bus bits 31 to 0 this means that when address h'00001003 is set in the break address register (bara or barb), for example, the bus cycle in which th e break condition is satisfied is as follows (where other conditions are met). longword access at h'00001000 word access at h'00001002 byte access at h'00001003 3. when the data value is included in the break conditions on channel b: when the data value is included in the break conditions, either longword, word, or byte is specified as the operand size of the break bus cycle register b (bbrb). when data values are included in break conditions, a break is gene rated when the address conditions and data conditions both match. to specify byte data for th is case, set the same data in two bytes at bits 15 to 8 and bits 7 to 0 of the break data register b (bdrb) and break data mask register b (bdmrb). when word or byte is set, bits 31 to 16 of bdrb and bdmrb are ignored. set the
section 11 user break controller (ubc) rev. 4.00 sep. 14, 2005 page 259 of 982 rej09b0023-0400 word data in bits 31 to 16 in bdrb and bdmrb when including the value of the data bus as a break condition for the movs.w @-as,ds, movs.w @as,ds, movs.w @as+,ds, or movs.w @as+ix,ds instruction (bits 15 to 0 are ignored). 4. access by a pref instruction is handled as read access in long word units without access data. therefore, if including the value of the data bus when a pref instruction is specified as a break condition, a break will not occur. 5. if the l bus is selected, a break occurs on en ding execution of the instruction that matches the break condition, and immediately before the next instruction is executed. however, when data is also specified as the break condition, the break may occur on ending execution of the instruction following the instruction that matches the break condition. if the i bus is selected, the instruction at which the break will occur cannot be determined. when this kind of break occurs at a delayed branch inst ruction or its delay slot, the break may not actually take place until the first instruction at the branch destination. 11.3.4 break on x/y-memory bus cycle 1. the break condition on an x/y-memory bus cycl e is specified only in channel b. if the xye bit in bbrb is set to 1, the break address and br eak data on x/y-memory bus are selected. at this time, select the x-memory bus or y-memo ry bus by specifying th e xys bit in bbrb. the break condition cannot include both x-memory and y-memory at the same time. the break condition is applied to an x/ y-memory bus cycle by specify ing l bus/data access/read or write/word or no specified operand size in bits 7 to 0 in the break bus cycle register b (bbrb). 2. when an x-memory address is selected as the break condition , specify an x-memory address in the upper 16 bits in barb and bamrb. when a y-memory address is selected, specify a y-memory address in the lower 16 bits. specif ication of x/y-memory data is the same for bdrb and bdmrb. 3. the timing of a data access break for the x memory or y memory bus to occur is the same as a data access break of the l bus. for details, se e 5 in section 11.3.3, break on data access cycle.
section 11 user break controller (ubc) rev. 4.00 sep. 14, 2005 page 260 of 982 rej09b0023-0400 11.3.5 sequential break 1. by setting the seq bit in brcr to 1, the sequential break is issued when a channel b break condition matches after a channel a break conditio n matches. a user break is not generated even if a channel b break condition matches before a channel a break condition matches. when channels a and b conditions match at the sa me time, the sequential break is not issued. to clear the channel a condition match when a channel a condition match has occurred but a channel b condition match has not yet occurred in a sequential break specification, clear the seq bit in brcr to 0. 2. in sequential break specifica tion, the l/i/x/y bus can be se lected and the execution times break condition can be also specified. for example, when the execution times break condition is specified, the break condition is satisfied when a channel b condition matches with betr = h'0001 after a channel a condition has matched. 11.3.6 value of saved program counter when a break occurs, the address of the instruction from where execution is to be resumed is saved in the spc, and the exception handling state is entered. if the l bus is specified as a break condition, the instruction at which the break should occur can be clearly determined (except for when data is included in the break condition). if the i bus is specified as a break condition, the instruction at which the break should occur cannot be clearly determined. 1. when instruction fetch (before instruction execution) is specified as a break condition: the address of the instruction that matched the break condition is saved in the spc. the instruction that matched the condition is not executed, and the break occurs before it. however when a delay slot instruction matches the condition, the address of the delayed branch instruction is saved in the spc. 2. when instruction fetch (after instruction ex ecution) is specified as a break condition: the address of the instruction following the in struction that matched the break condition is saved in the spc. the instruction that matches the condition is executed , and the break occurs before the next instruction is executed. however when a delayed branch instruction or delay slot matches the condition, these instructions ar e executed, and the branch destination address is saved in the spc. 3. when data access (address only) is specified as a break condition: the address of the instruction immediately after the instruction that matched the break condition is saved in the spc. the instruction that matches the condition is executed, and the break occurs before the next instruction is executed. however when a delay slot instruction matches the condition, the branch dest ination address is saved in the spc.
section 11 user break controller (ubc) rev. 4.00 sep. 14, 2005 page 261 of 982 rej09b0023-0400 4. when data access (address + data) is specified as a break condition: when a data value is added to the break conditions, the address of an instruction that is within two instructions of the instruction that matc hed the break condition is saved in the spc. at which instruction the break occurs cannot be determined accurately. when a delay slot instruction matches the condition, the branch destination address is saved in the spc. if the instruction following the instruction that matches the break condition is a branch instruction, the break may occur after the branch instruction or delay slot has finished. in this case, the branch destina tion address is saved in the spc. 11.3.7 pc trace 1. setting pcte in brcr to 1 enables pc traces. when branch (branch instruction, and interrupt exception) is generated, the bran ch source address and branch de stination address are stored in brsr and brdr, respectively. 2. the values stored in brsr and brdr are as given below due to the kind of branch. ? if a branch occurs due to a bran ch instruction, the address of the branch instruction is saved in brsr and the address of the branch de stination instruction is saved in brdr. ? if a branch occurs due to an interrupt or exception, the value saved in spc due to exception occurrence is saved in brsr an d the start address of the exception handling routine is saved in brdr. when a repeat loop of the dsp extended function is used, control being transferred from the repeat end instruction to the repeat start inst ruction is not recognized as a branch, and the values are not stored in brsr and brdr. 3. brsr and brdr have eight pairs of queue struct ures. the top of queues is read first when the address stored in the pc trace register is read. brsr and brdr share the read pointer. read brsr and brdr in order, the queue only shif ts after brdr is read. after switching the pcte bit (in brcr) off and on, the values in the queues are invalid.
section 11 user break controller (ubc) rev. 4.00 sep. 14, 2005 page 262 of 982 rej09b0023-0400 11.3.8 usage examples break condition specified for l bus instruction fetch cycle: (example 1-1) ? register specifications bara = h'00000404, bamra = h'00000000, bbra = h'0054, barb = h'00008010, bamrb = h'00000006, bbrb = h'0054, bdrb = h'00000000, bdmrb = h'00000000, brcr = h'00000400 specified conditions: channel a/channel b independent mode address: h'00000404, address mask: h'00000000 bus cycle: l bus/instruction fe tch (after instruction executio n)/read (operand size is not included in the condition) address: h'00008010, address mask: h'00000006 data: h'00000000, data mask: h'00000000 bus cycle: l bus/instruction fe tch (before instruction executi on)/read (operand size is not included in the condition) a user break occurs after an instruction of address h'00000404 is executed or before instructions of addresses h'00008010 to h'00008016 are executed. (example 1-2) ? register specifications bara = h'00037226, bamra = h'00000000 , bbra = h'0056, barb = h'0003722e, bamrb = h'00000000, bbrb = h'0056, bdrb = h'00000000, bdmrb = h'00000000, brcr = h'00000008 specified conditions: channel a/channel b sequential mode address: h'00037226, address mask: h'00000000 bus cycle: l bus/instruction fetch (b efore instruction execution)/read/word address: h'0003722e, address mask: h'00000000 data: h'00000000, data mask: h'00000000 bus cycle: l bus/instruction fetch (b efore instruction execution)/read/word
section 11 user break controller (ubc) rev. 4.00 sep. 14, 2005 page 263 of 982 rej09b0023-0400 after an instruction with and address h'00037226 is executed, a user break occurs before an instruction with and address h'0003722e is executed. (example 1-3) ? register specifications bara = h'00027128, bamra = h'00000000, bbra = h'005a, barb = h'00031415, bamrb = h'00000000, bbrb = h'0054, bdrb = h'00000000, bdmrb = h'00000000, brcr = h'00000000 specified conditions: channel a/channel b independent mode address: h'00027128, address mask: h'00000000 bus cycle: l bus/instruction fetch (before instruction execution)/write/word address: h'00031415, address mask: h'00000000 data: h'00000000, data mask: h'00000000 bus cycle: l bus/instruction fetch (before in struction execution)/read (operand size is not included in the condition) on channel a, no user break occurs since instru ction fetch is not a write cycle. on channel b, no user break occurs since instruction fetch is performed for an even address. (example 1-4) ? register specifications bara = h'00037226, bamra = h'00000000, bbra = h'005a, barb = h'0003722e, bamrb = h'00000000, bbrb = h'0056, bdrb = h'00000000, bdmrb = h'00000000, brcr = h'00000008 specified conditions: channel a/channel b sequential mode address: h'00037226, address mask: h'00000000 bus cycle: l bus/instruction fetch (before instruction execution)/write/word address: h'0003722e, address mask: h'00000000 data: h'00000000, data mask: h'00000000 bus cycle: l bus/instruction fetch (b efore instruction execution)/read/word since instruction fetch is not a write cycle on channel a, a sequenti al condition does not match. therefore, no user break occurs.
section 11 user break controller (ubc) rev. 4.00 sep. 14, 2005 page 264 of 982 rej09b0023-0400 (example 1-5) ? register specifications bara = h'00000500, bamra = h'00000000, bbra = h'0057, barb = h'00001000, bamrb = h'00000000, bbrb = h'0057, bdrb = h'00000000, bdmrb = h'00000000, brcr = h'00000001, betr = h'0005 specified conditions: channel a/channel b independent mode address: h'00000500, address mask: h'00000000 bus cycle: l bus/instruc tion fetch (before instruc tion execution)/read/longword address: h'00001000, address mask: h'00000000 data: h'00000000, data mask: h'00000000 bus cycle: l bus/instruc tion fetch (before instruc tion execution)/read/longword the number of exec ution-times break enable (5 times) on channel a, a user break occurs before an instruction of address h'00000500 is executed. on channel b, a user break occurs after the instruction of address h'00001000 are executed four times and before the fifth time. (example 1-6) ? register specifications bara = h'00008404, bamra = h'00000fff, bbra = h' 0054, barb = h'00008010, bamrb = h'00000006, bbrb = h'0054, bdrb = h'00000000, bdmrb = h'00000000, brcr = h'00000400 specified conditions: channel a/channel b independent mode address: h'00008404, address mask: h'00000fff bus cycle: l bus/instruction fe tch (after instruction execution)/read (operand size is not included in the condition) address: h'00008010, address mask: h'00000006 data: h'00000000, data mask: h'00000000 bus cycle: l bus/instruction fe tch (before instruction executi on)/read (operand size is not included in the condition) a user break occurs after an in struction with addresses h'00008000 to h'00008ffe is executed or before an instruction with addresses h'00008010 to h'00008016 are executed.
section 11 user break controller (ubc) rev. 4.00 sep. 14, 2005 page 265 of 982 rej09b0023-0400 break condition specified fo r l bus data access cycle: (example 2-1) ? register specifications bara = h'00123456, bamra = h'00000000 , bbra = h'0064, barb = h'000abcde, bamrb = h'000000ff, bbrb = h'006a, bdrb = h'0000a512, bdmrb = h'00000000, brcr = h'00000080 specified conditions: channel a/channel b independent mode address: h'00123456, address mask: h'00000000 bus cycle: l bus/data access/read (operand size is not included in the condition) address: h'000abcde, address mask: h'000000ff data: h'0000a512, data mask: h'00000000 bus cycle: l bus/data access/write/word on channel a, a user break occurs with longword read from address h'00123454, word read from address h'00123456, or byte read from address h'00123456. on channel b, a user break occurs when word h'a512 is written in addresses h'000abc00 to h'000abcfe. (example 2-2) ? register specifications bara = h'01000000, bamra = h'00000000, bbra = h'0066, barb = h'0000f000, bamrb = h'ffff0000, bbrb = h'036a, bdrb = h'00004567, bdmrb = h'00000000, brcr = h'00000080 specified conditions: channel a/channel b independent mode address: h'01000000, address mask: h'00000000 bus cycle: l bus/data access/read/word y address: h'0000f000, address mask: h'ffff0000 data: h'00004567, data mask: h'00000000 bus cycle: y bus/data access/write/word on channel a, a user break occurs during word read from address h'01000000 in the memory space. on channel b, a user break occurs when word data h'4567 is written in address h'0000f000 in the y memory space. the x/y-memo ry space is changed by a mode setting.
section 11 user break controller (ubc) rev. 4.00 sep. 14, 2005 page 266 of 982 rej09b0023-0400 break condition specified fo r i bus data access cycle: (example 3-1) ? register specifications bara = h'00314156, bamra = h'00000000, bbra = h'0094, barb = h'00055555, bamrb = h'00000000, bbrb = h'00a9, bdrb = h'00007878, bdmrb = h'00000f0f, brcr = h'00000080 specified conditions: channel a/channel b independent mode address: h'00314156, address mask: h'00000000 bus cycle: i bus/instruction fetch/read (operand size is not included in the condition) address: h'00055555, address mask: h'00000000 data: h'00000078, data mask: h'0000000f bus cycle: i bus/data access/write/byte on channel a, a user break occurs when instruction fetch is performed for address h'00314156 in the memory space. on channel b, a user break occurs when th e i bus writes byte data h'7* in address h'00055555. 11.4 usage notes 1. the cpu can read from or wr ite to the ubc registers via the i bus. accordingly, during the period from executing an instruction to rewrite the ubc register till the new value is actually rewritten, the desired break may not occur. in or der to know the timing when the ubc register is changed, read from the last written register. instructions after then are valid for the newly written register value. 2. ubc cannot monitor access to the l bu s and i bus in the same channel. 3. note on specification of sequential break: a condition match occurs when a b-channel match occurs in a bus cycle after an a-channel match occurs in another bus cycle in sequential break setting. therefore, no break occurs even if a bus cycle, in which an a-channel match and a channel b match occur simultaneously, is set.
section 11 user break controller (ubc) rev. 4.00 sep. 14, 2005 page 267 of 982 rej09b0023-0400 4. when a user break and another exception occur at the same instruction, which has higher priority is determined according to the priority levels defined in table 9.1 in section 9, exception handling. if an exception with higher priority occurs, the user break is not generated. ? pre-execution break has the highest priority. ? when a post-execution break or data access break occurs simultaneously with a re- execution-type exception (includi ng pre-execution break) that has higher priority, the re- execution-type exception is a ccepted, and the condition match flag is not set (see the exception in the following note). the break will occur and the condition match flag will be set only after the exception source of the re-e xecution-type exception has been cleared by the exception handling routine and re-execution of the same instruction has ended. ? when a post-execution break or data acce ss break occurs simultaneously with a completion-type exception (trapa) that has higher priority, though a break does not occur, the condition match flag is set. 5. note the following ex ception for the above note. if a post-execution break or data access break is satisfied by an instruction that generates a cpu address error by data access, the cpu address error is give n priority to the break. note that the ubc condition match flag is set in this case. 6. note the following when a break occurs in a delay slot. if a pre-execution break is set at the delay slot instruction of the rte instruction, the break does not occur until the branch destination of the rte instruction. 7. user breaks are disabled during usb module standby mode. do not read from or write to the ubc registers during usb module standby mode; the values are not guaranteed. 8. when the repeat loop of the dsp extended function is used, even though a break condition is satisfied during execution of the entire repeat loop or several instructions in the repeat loop, the break may be held. for details, see section 9, exception handling.
section 11 user break controller (ubc) rev. 4.00 sep. 14, 2005 page 268 of 982 rej09b0023-0400
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 269 of 982 rej09b0023-0400 section 12 bus state controller (bsc) the bus state controller (bsc) outputs control si gnals for various types of memory that is connected to the external address space and external devices. bsc functions enable this lsi to connect directly with sram, sdram, and other memory storage devices, and external devices. 12.1 features the bsc has the following features: 1. physical address space is divided into eight areas ? a maximum 32 or 64 mbytes for each of the eight areas, cs0, cs2 to cs4, cs5a, cs5b, cs6a and cs6b, totally 384 mbytes. ? a maximum 64 mbytes for each of the six areas , cs0, cs2 to cs4, cs5, and cs6, totally a total of 384 mbytes. ? can specify the normal space interface, sram interface with byte selection, burst rom (clock synchronous or asynchronous), mpx-i/o, burst mpx-i/o, and sdram for each address space. ? can select the data bus width (8, 16 , or 32 bits) for each address space. ? controls the insertion of the wa it state for each address space. ? controls the insertion of the wait stat e for each read access and write access. ? can set the independent idling cycle in the c ontinuous access for five cases: read-write (in same space/different space), read -read (in same space/different space), the first cycle is a write access. 2. normal space interface ? supports the interface that can directly connect to the sram. 3. burst rom interface (clock asynchronous) ? high-speed access to the rom that has the page mode function. 4. mpx-i/o interface ? can directly connect to a peripheral lsi that needs an address/data multiplexing. 5. sdram interface ? can set the sdram up to 2 areas. ? multiplex output for row address/column address. ? efficient access by single read/single write. ? high-speed access by the bank-active mode. ? supports an auto-refresh and self-refresh.
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 270 of 982 rej09b0023-0400 ? supports low-frequency and power-down modes. ? issues mrs and emrs commands. 6. byte-selection sram interface ? can connect directly to a byte-selection sram 7. burst mpx-io interface ? can connect directly to a peripheral lsi that needs an address/data multiplexing. ? supports burst transfer 8. burst rom interface (clock synchronous) ? can connect directly to a rom of the clock synchronous type 9. bus arbitration ? shares all of the resources with other cpu an d outputs the bus enable after receiving the bus request from external devices. 10. refresh function ? supports the auto-refresh and self-refresh functions. ? specifies the refresh interval using th e refresh counter and clock selection ? can execute concentrated refresh by specifying the refresh counts (1, 2, 4, 6, or 8)
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 271 of 982 rej09b0023-0400 bsc functional block diagram is shown in figure 12.1. cmncr cs0wcr cs6bwcr rwtcnt cs0bcr cs6bbcr sdcr rtcsr rtcnt rtcor comparator bus mastership controller wait controller area controller internal bus memory controller refresh controller [legend] module bus bsc cs0, cs2, cs3, cs4, cs5a, cs5b, cs6a, cs6b wait md3 a25 to a0, d31 to d0 back breq bs, rd/wr, rd, we3 to we0, rasu, rasl, casu, casl cke, dqmxx, ah, frame cmncr: csnwcr: rwtcnt: csnbcr: sdcr: rtcsr: rtcnt: rtcor: common control register csn space wait control register (n = 0, 2, 3, 4, 5a, 5b, 6a, 6b) reset wait counter csn space bus control register (n = 0, 2, 3, 4, 5a, 5b, 6a, 6b) sdram control register refresh timer control/status register refresh timer counter refresh time constant register . . . . . . . . . . . . . . . figure 12.1 bsc functional block diagram
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 272 of 982 rej09b0023-0400 12.2 input/output pins table 12.1 shows pin configuration of the bsc. table 12.1 pin configuration name i/o function a25 to a0 output address bus d31 to d0 i/o data bus bs output bus cycle start cs0 , cs2 to cs4 output chip select cs5a output chip select active only for address map 1 rd/ wr output read/write connects to we pins when sdram or byte-selection sram is connected. rd output read pulse signal (read data output enable signal) we3 / iciowr / ah output indicates that d31 to d24 are being written to. connected to the byte select signal when a byte-selection sram is connected. functions as the address hold signal when the mpx-io is used. functions as the selection signals for d31 to d24 when sdram is connected. we2 / icird output indicates that d23 to d16 are being written to. connected to the byte select signal when a byte-selection sram is connected. functions as the selection signals for d23 to d16 when sdram is connected. we1 / we output indicates that d15 to d8 are being written to. connected to the byte select signal when a byte-selection sram is connected. functions as the selection signals for d15 to d8 when sdram is connected.
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 273 of 982 rej09b0023-0400 name i/o function we0 output indicates that d7 to d0 are being written to. connected to the byte select signal when a byte-selection sram is connected. functions as the selection signals for d7 to d0 when sdram is connected. rasu rasl output connects to ras pin when sdram is connected. casu casl output connects to cas pin when sdram is connected. cke output clock enable for sdram frame output functions as frame sign al when connected to burst mpx-io interface wait input external wait input breq input bus request input back output bus enable input md3 input md3: select ar ea 0 bus width (16/32 bits) 12.3 area overview 12.3.1 area division in the architecture of this lsi, both logical spaces and physical spaces have 32-bit address spaces. the cache access method is shown by the upper thre e bits. for details see section 7, cache. the remaining 29 bits are used for division of the sp ace into ten areas (address map 1) or eight areas (address map 2) according to the map bit in the cmncr register setting. the bsc performs control for this 29-bit space. as listed in tables 12.2 and 12.3, this lsi can conn ect various memories to eight areas or six areas, and it outputs chip select signals ( cs0 , cs2 to cs4 , cs5a , cs5b , cs6a , and cs6b ) for each of them. cs0 is asserted during area 0 access; cs5a is asserted during area 5a access when address map 1 is selected; and cs5b is asserted when address map 2 is selected. also cs6a is asserted during area 6a access when address map 1 is selected; and cs6b is asserted when address map 2 is selected.
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 274 of 982 rej09b0023-0400 12.3.2 shadow area areas 0, 2 to 4, 5a, 5b, 6a, and 6b are decoded by addresses a28 to a26, which correspond to areas 000 to 110. address bits 31 to 29 are ignore d. this means that the range of area 0 addresses, for example, is h'00000000 to h'03ffffff, and its co rresponding shadow space is the address space between p0 and p3 obtained by adding to it h'20000000 n (n = 1 to 6). the address range for area 7 is h'1c000000 to h'1fffffff. the address space h'1c000000 + h'20000000 n? h'1fffffff + h'20000000 n (n = 0 to 7) corresponding to the area 7 shadow space is reserved, so do not use it. area p4 (h'e0000000 to h'efffffff) is an i/o area and is assigned for internal register addresses. area 0 (cs0) h'00000000 h'20000000 h'40000000 h'60000000 h'80000000 h'a0000000 h'c0000000 h'e0000000 area 1 (internal i/o) area 2 (cs2) area 3 (cs3) area 4 (cs4) area 5a (cs5a) area 6a (cs6a) area 7 (reserved) address spacesby a28 to a0 address spaces by a31 to a0 p0 p1 p2 p3 p4 area 5b (cs5b) area 6b (cs6b) figure 12.2 address space
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 275 of 982 rej09b0023-0400 12.3.3 address map the external address space has a ca pacity of 384 mbytes and is us ed by dividing 8 partial spaces. the kind of memory to be connected and the da ta bus width are specified in each partial space. the address map for the external address space is listed below. table 12.2 address space map 1 (cmncr.map = 0) physical address area memory to be connected capacity h'00000000 to h'03ffffff area 0 normal memory burst rom (asynchronous) burst rom (synchronous) 64 mbytes h'04000000 to h'07ffffff area 1 in ternal i/o register area * 2 64 mbytes h'08000000 to h'0bffffff area 2 normal memory byte-selection sram sdram 64 mbytes h'0c000000 to h'0fffffff area 3 normal memory byte-selection sram sdram 64 mbytes h'10000000 to h'13ffffff area 4 normal memory byte-selection sram burst rom (asynchronous) 64 mbytes h'14000000 to h'15ffffff area 5a normal memory 32 mbytes h'16000000 to h'17ffffff area 5b normal memory byte-selection sram mpx-i/o 32 mbytes h'18000000 to h'19ffffff area 6a normal memory 32 mbytes h'1a000000 to h'1bffffff area 6b normal memory byte-selection sram mpx-i/o 32 mbytes h'1c000000 to h'1fffffff area 7 reserved * 1 64 mbytes notes: 1. do not access the reserved area. if t he reserved area is accessed, the correct operation cannot be guaranteed. 2. access the address indicated in section 24, list of registers, for the on-chip i/o register in area 1. do not access area 1 addresses wh ich are not described in the register map. otherwise, the correct operat ion cannot be guaranteed.
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 276 of 982 rej09b0023-0400 table 12.3 address space map 2 (cmncr.map = 1) physical address area memory to be connected capacity h'00000000 to h'03ffffff area 0 normal memory burst rom (asynchronous) burst rom (synchronous) 64 mbytes h'04000000 to h'07ffffff area 1 internal i/o register area* 3 64 mbytes h'08000000 to h'0bffffff area 2 normal memory byte-selection sram sdram 64 mbytes h'0c000000 to h'0fffffff area 3 normal memory byte-selection sram sdram 64 mbytes h'10000000 to h'13ffffff area 4 normal memory byte-selection sram burst rom (asynchronous) 64 mbytes h'14000000 to h'17ffffff area 5* 2 normal memory byte-selection sram mpx-i/o 64 mbytes h'18000000 to h'1bffffff area 6* 2 normal memory byte-selection sram burst mpx-i/o 64 mbytes h'1c000000 to h'1fffffff area 7 reserved * 1 64 mbytes notes: 1. do not access the reserved area. if the reserved area is accessed, the correct operation cannot be guaranteed. 2. for area 5, the cs5bbcr and cs5bwcr registers and the cs5b signal are valid. for area 6, the cs6bbcr and cs6bwcr registers and the cs6b signal are valid. 3. access the address indicated in section 24, list of registers, for the on-chip i/o register in area 1. do not access area 1 addresses wh ich are not described in the register map. otherwise, the correct operat ion cannot be guaranteed.
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 277 of 982 rej09b0023-0400 12.3.4 area 0 memory ty pe and memory bus width the memory bus width in this lsi can be set for each area. in area 0, external pins can be used to select word (16 bits), or longword (32 bits) on power-on reset. the correspondence between the external pin md3 and memory size is listed in the table below. table 12.4 correspondence between external pin md3 and bus width of area 0 md3 bus width of area 0 0 16 bits 1 32 bits 12.4 register descriptions the bsc has the following regist ers. for the addresses and access sizes of these registers, see section 24, list of registers. do not access spaces other than cs0 until the term ination of the setting the memory interface. ? common control register (cmncr) ? bus control register for area 0 (cs0bcr) ? bus control register for area 2 (cs2bcr) ? bus control register for area 3 (cs3bcr) ? bus control register for area 4 (cs4bcr) ? bus control register for area 5a (cs5abcr) ? bus control register for area 5b (cs5bbcr) ? bus control register for area 6a (cs6abcr) ? bus control register for area 6b (cs6bbcr) ? wait control register for area 0 (cs0wcr) ? wait control register for area 2 (cs2wcr) ? wait control register for area 3 (cs3wcr) ? wait control register for area 4 (cs4wcr) ? wait control register for area 5a (cs5awcr) ? wait control register for area 5b (cs5bwcr) ? wait control register for area 6a (cs6awcr) ? wait control register for area 6b (cs6bwcr) ? sdram control register (sdcr)
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 278 of 982 rej09b0023-0400 ? refresh timer control/st atus register (rtcsr) ? refresh timer counter (rtcnt) ? refresh time constant register (rtcor) ? reset wait counter (rwtcnt) 12.4.1 common control register (cmncr) cmncr is a 32-bit register that controls the common items for eac h area. this register is only initialized by a power-on reset, and it is not initialized by a manual reset and in the standby mode. do not access external memory other than area 0 until the cmncr register initialization is complete. bit bit name initial value r/w description 31 to 16 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 15 waitsel 0 r/w wait signal sampling timing specification specifies the external wait signal sampling timing. 0: samples the wait signal at the falling edge of the ckio. in this case, the wait signal can be input asynchronously. 1: samples the wait signal at the rising edge of the ckio. in this case, the wait signal must be input synchronously. 14, 13 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 12 map 0 r/w space specification selects the address map for the external address space. the address maps to be selected are shown in tables 12.2 and 12.3. 0: selects address map 1. 1: selects address map 2.
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 279 of 982 rej09b0023-0400 bit bit name initial value r/w description 11 block 0 r/w bus clock specifies whether or not the breq signal is received. 0: receives breq. 1: does not receive breq. 10 9 dprty1 dprty0 0 0 r/w r/w dma burst transfer priority specify the priority for a refresh request/bus mastership request during dma burst transfer. 00: accepts a refresh request and bus mastership request during dma burst transfer. 01: accepts a refresh request but does not accept a bus mastership request during dma burst transfer. 10: accepts neither a refresh request nor a bus mastership request during dma burst transfer. 11: reserved (setting prohibited) 8 7 6 dmaiw2 dmaiw1 dmaiw0 0 0 0 r/w r/w r/w wait states between access cycles when dma single address transfer is performed. specify the number of idle cycles to be inserted after an access to an external device with dack when dma single address transfer is performed. the method of inserting idle cycles depends on the contents of dmaiwa. 000: no idle cycle inserted 001: 1 idle cycle inserted 010: 2 idle cycles inserted 011: 4 idle cycled inserted 100: 6 idle cycled inserted 101: 8 idle cycle inserted 110: 10 idle cycles inserted 111: 12 idle cycled inserted
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 280 of 982 rej09b0023-0400 bit bit name initial value r/w description 5 dmaiwa 0 r/w method of inserting wait states between access cycles when dma single address transfer is performed. specifies the method of in serting the idle cycles specified by the dmaiw[2:0] bit. clearing this bit will make this lsi insert the idle cycles when another device, which includes this lsi, drives the data bus after an external device with dack drove it. however, when the external device with dack drives the data bus continuously, idle cycles are not inserted. setting this bit will make this lsi in sert the idle cycles after an access to an external device with dack , even when the continuous accesses to an external device with dack are performed. 0: idle cycles inserted when another device drives the data bus after an external device with dack drove it. 1: idle cycles always inserted after an access to an external device with dack 4 ? 1 r reserved this bit is always read as 1. the write value should always be 1. 3 ? 0 r reserved this bit is always read as 0. the write value should always be 0. 2 ckd2rdv 0 r ckio2 drive specifies whether the ckio2 pin outputs a low level signal or clock (b ). in clock mode 7 (ckio pin input), the ckio2 pin has high impedance. the ck2drv bit setting is enabled in the 2 or 6 clock mode. 0: outputs a low level signal 1: outputs a clock (b ) 1 hizmem 0 r/w high-z memory control specifies the pin state in software standby mode for a25 to a0, bs, cs , rd/ wr , wen /dqnxx, rd, and frame . 0: high impedance in standby mode. 1: driven in standby mode
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 281 of 982 rej09b0023-0400 bit bit name initial value r/w description 0 hizcnt 0 r/w high-z control specifies the state in software standby mode and bus released for ckio2, rasu , rasl , casu , and casl . 0: high impedance in software standby mode and bus released for ckio2, rasu , rasl , casu , and casl . 1: driven in standby mode and bus released for ckio2, rasu , rasl , casu , and casl . 12.4.2 csn space bus control register (csnbcr) (n = 0, 2, 3, 4, 5a, 5b, 6a, 6b) csnbcr is a 32-bit readable/writabl e register that specifies the fu nction of each area, the number of idle cycles between bus cycles, and the bus-widt h. this register is initialized to h'36db0600 by a power-on reset, and it is not initialized by a manual reset and in the standby mode. do not access external memory other than ar ea 0 until csnbcr register initialization is completed. bit bit name initial value r/w description 31 ? 0 r reserved this bit is always read as 0. the write value should always be 0. 30 29 28 iww2 iww1 iww0 1 1 1 r/w r/w r/w idle cycles between write-read cycles and write- write cycles these bits specify the number of idle cycles to be inserted after the access to a memory that is connected to the space. the target access cycles are the write-read cycle an d write-write cycle. 000: no idle cycle inserted 001: 1 idle cycle inserted 010: 2 idle cycles inserted 011: 4 idle cycles inserted 100: 6 idle cycles inserted 101: 8 idle cycles inserted 110: 10 idle cycles inserted 111: 12 idle cycles inserted
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 282 of 982 rej09b0023-0400 bit bit name initial value r/w description 27 26 25 iwrwd2 iwrwd1 iwrwd0 1 1 1 r/w r/w r/w idle cycles for another space read-write specify the number of idle cycles to be inserted after the access to a memory that is connected to the space. the target access cycle is a read-write one in which continuous accesses switch between different spaces. 000: no idle cycle inserted 001: 1 idle cycle inserted 010: 2 idle cycles inserted 011: 4 idle cycles inserted 100: 6 idle cycles inserted 101: 8 idle cycles inserted 110: 10 idle cycles inserted 111: 12 idle cycles inserted 24 23 22 iwrws2 iwrws1 iwrws0 1 1 1 r/w r/w r/w idle cycles for read-write in the same space specify the number of idle cycles to be inserted after the access to a memory that is connected to the space. the target cycle is a read-write cycle of which continuous accesses are for the same space. 000: no idle cycle inserted 001: 1 idle cycle inserted 010: 2 idle cycles inserted 011: 4 idle cycles inserted 100: 6 idle cycles inserted 101: 8 idle cycles inserted 110: 10 idle cycles inserted 111: 12 idle cycles inserted
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 283 of 982 rej09b0023-0400 bit bit name initial value r/w description 21 20 19 iwrrd2 wrrd1 iwrrd0 1 1 1 r/w r/w r/w idle cycles for read-read in another space specify the number of idle cycles to be inserted after the access to a memory that is connected to the space. the target cycle is a read-read cycle of which continuous accesses switch between different spaces. 000: no idle cycle inserted 001: 1 idle cycle inserted 010: 2 idle cycles inserted 011: 4 idle cycles inserted 100: 6 idle cycles inserted 101: 8 idle cycles inserted 110: 10 idle cycles inserted 111: 12 idle cycles inserted 18 17 16 iwrrs2 iwrrs1 iwrrs0 1 1 1 r/w r/w r/w idle cycles for read-read in the same space specify the number of idle cycles to be inserted after the access to a memory that is connected to the space. the target cycle is a read-read cycle of which continuous accesses are for the same space. 000: no idle cycle inserted 001: 1 idle cycle inserted 010: 2 idle cycles inserted 011: 4 idle cycles inserted 100: 6 idle cycles inserted 101: 8 idle cycles inserted 110: 10 idle cycles inserted 111: 12 idle cycles inserted 15 ? 0 r reserved this bit is always read as 0. the write value should always be 0.
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 284 of 982 rej09b0023-0400 bit bit name initial value r/w description 14 13 12 type2 type1 type0 0 0 0 r/w r/w r/w specify the type of memory connected to a space. 0000: normal space 0001: burst rom (clock synchronous) 0010: mpx-i/o 0011: byte-selection sram 0100: sdram 0101: reserved (setting prohibited) 0110: burst mpx-i/o 0111: burst rom (clock synchronous) for details for memory type in each area, refer to tables 12.2 and 12.3. 11 ? 0 r reserved this bit is always read as 0. the write value should always be 0.
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 285 of 982 rej09b0023-0400 bit bit name initial value r/w description 10 9 bsz1 bsz0 1 * 1 * r/w r/w data bus size specify the data bus sizes of spaces. the data bus sizes of areas 2, 3, 4 and 5a are shown below. 00: reserved (setting prohibited) 01: 8-bit size 10: 16-bit size 11: 32-bit size for mpx-i/o, selects bus width by address notes: 1. if area 5b is specified as mpx-i/o, the bus width can be specified as 8 bits or 16 bits by the address according to the szsel bit in cs5bwcr by specifying these bits to 11. 2. the data bus width for area 0 is specified by the external pin. the bsz1 and bsz0 bit settings in the cs0bcr register are ignored. 3. if area 6 is specified as burst mpx-i/o, the bus width can be specified as 32 bits only. 4. if area 2 or area 3 is specified as sdram space, the bus width can be specified as either 16 bits or 32 bits. 8 to 0 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. note: * the cs0cr samples the external pins (md3) that specify the bus width at power-on reset.
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 286 of 982 rej09b0023-0400 12.4.3 csn space wait control register (csnwcr) (n = 0, 2, 3, 4, 5a, 5b, 6a, 6b) this register specifies various wait cycles for memory accesses. the bit configuration of this register varies as shown below according to the memory type (type2 to type0) specified by the csn space bus control register (csnbcr). specify the csnwcr register before accessing the target area. specify csnbcr register first, then specify the csnwcr register. csnwcr is initialized to h'00000500 by a power-on reset, and it is not initialized by a manual reset and in the standby mode. normal space, byte-sel ection sram, mpx-i/o: ? cs0wcr bit bit name initial value r/w description 31 to 13 ?* all 0 r/w reserved when the normal space interface and sram interface with byte selection are specified, these bits should be set to 0. 12 11 sw1 sw0 0 0 r/w r/w number of delay cycles from address, csn assertion to rd, wen assertion specify the number of delay cycles from address and csn assertion to rd and wen assertion. 00: 0.5 cycles 01: 1.5 cycles 10: 2.5 cycles 11: 3.5 cycles
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 287 of 982 rej09b0023-0400 bit bit name initial value r/w description 10 9 8 7 wr3 wr2 wr1 wr0 1 0 1 0 r/w r/w r/w r/w number of access wait cycles specify the number of cycles that are necessary for read/write access. 0000: no cycle 0001: 1 cycle 0010: 2 cycles 0011: 3 cycles 0100: 4 cycles 0101: 5 cycles 0110: 6 cycles 0111: 8 cycles 1000: 10 cycles 1001: 12 cycles 1010: 14 cycles 1011: 18 cycles 1100: 24 cycles 1101: reserved (setting prohibited) 1110: reserved (setting prohibited) 1111: reserved (setting prohibited) 6 wm 0 r/w external wait mask specification specifies whether or not the external wait input is valid. the specification by this bit is valid even when the number of access wait cycle is 0. 0: external wait is valid 1: external wait is ignored 5 to 2 ? all 0 r reserved these bits are always read as 0. the write value should always be 0.
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 288 of 982 rej09b0023-0400 bit bit name initial value r/w description 1 0 hw1 hw0 0 0 r/w r/w delay cycles from rd, wen negation to address, csn negation specify the number of delay cycles from rd and wen negation to address and csn negation. 00: 0.5 cycles 01: 1.5 cycles 10: 2.5 cycles 11: 3.5 cycles note: * to connect the burst rom to the cs0 area and use the burst rom interface after the bsc is activated, enables the burst access thr ough bit 20, specifies the number of burst wait cycles through bits 17 and 16, and then set the bi ts type[2:0] in cs0bcr. reserved bits other than above should not be set to 1. for details on the burst rom interfac e, see burst rom (clock asynchronous). ? cs2wcr, cs3wcr bit bit name initial value r/w description 31 to 21 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 20 bas 0 r/w byte-selection sram byte access selection specifies the wen and rd/ wr signal timing when the byte-selection sram interface is used. 0: asserts the wen signal at the read timing and asserts the rd/ wr signal during the write access cycle. 1: asserts the wen signal during the read access cycle and asserts the rd/ wr signal at the write timing. 19 to 11 ? all 0 r reserved these bits are always read as 0. the write value should always be 0.
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 289 of 982 rej09b0023-0400 bit bit name initial value r/w description 10 9 8 7 wr3 wr2 wr1 wr0 1 0 1 0 r/w r/w r/w r/w number of access wait cycles specify the number of cycles that are necessary for read/write access. 0000: no cycle 0001: 1 cycle 0010: 2 cycles 0011: 3 cycles 0100: 4 cycles 0101: 5 cycles 0110: 6 cycles 0111: 8 cycles 1000: 10 cycles 1001: 12 cycles 1010: 14 cycles 1011: 18 cycles 1100: 24 cycles 1101: reserved (setting prohibited) 1110: reserved (setting prohibited) 1111: reserved (setting prohibited) 6 wm 0 r/w external wait mask specification specifies whether or not the external wait input is valid. the specification by this bit is valid even when the number of access wait cycle is 0. 0: external wait is valid 1: external wait is ignored 5 to 0 ? all 0 r reserved these bits are always read as 0. the write value should always be 0.
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 290 of 982 rej09b0023-0400 ? cs4wcr bit bit name initial value r/w description 31 to 21 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 20 bas 0 r/w byte-selection sram byte access selection specifies the wen and rd/ wr signal timing when the byte-selection sram interface is used. 0: asserts the wen signal at the read timing and asserts the rd/ wr signal during the write access cycle. 1: asserts the wen signal during the read access cycle and asserts the rd/ wr signal at the write timing. 19 ? 0 r reserved this bit is always read as 0. the write value should always be 0. 18 17 16 ww2 ww1 ww0 0 0 0 r/w r/w r/w number of write access wait cycles specify the number of cycles that are necessary for write access. 000: the same cycles as wr[3:0] setting (number of read access wait cycles) 001: no cycle 010: 1 cycle 011: 2 cycles 100: 3 cycles 101: 4 cycles 110: 5 cycles 111: 6 cycles 15 to 13 ? all 0 r reserved these bits are always read as 0. the write value should always be 0.
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 291 of 982 rej09b0023-0400 bit bit name initial value r/w description 12 11 sw1 sw0 0 0 r/w r/w number of delay cycles from address, csn assertion to rd, we assertion specify the number of delay cycles from address and csn assertion to rd and we assertion. 00: 0.5 cycles 01: 1.5 cycles 10: 2.5 cycles 11: 3.5 cycles 10 9 8 7 wr3 wr2 wr1 wr0 1 0 1 0 r/w r/w r/w r/w number of read access wait cycles specify the number of cycles that are necessary for read access. 0000: no cycle 0001: 1 cycle 0010: 2 cycles 0011: 3 cycles 0100: 4 cycles 0101: 5 cycles 0110: 6 cycles 0111: 8 cycles 1000: 10 cycles 1001: 12 cycles 1010: 14 cycles 1011: 18 cycles 1100: 24 cycles 1101: reserved (setting prohibited) 1110: reserved (setting prohibited) 1111: reserved (setting prohibited) 6 wm 0 r/w external wait mask specification specifies whether or not the external wait input is valid. the specification by this bit is valid even when the number of access wait cycle is 0. 0: external wait is valid 1: external wait is ignored
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 292 of 982 rej09b0023-0400 bit bit name initial value r/w description 5 to 2 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 1 0 hw1 hw0 0 0 r/w r/w delay cycles from rd, wen negation to address, csn negation specify the number of delay cycles from rd and wen negation to address and csn negation. 00: 0.5 cycles 01: 1.5 cycles 10: 2.5 cycles 11: 3.5 cycles ? cs5awcr bit bit name initial value r/w description 31 to 19 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 18 17 16 ww2 ww1 ww0 0 0 0 r/w r/w r/w number of write access wait cycles specify the number of cycles that are necessary for write access. 000: the same cycles as wr[3:0] setting (number of read access wait cycles) 001: no cycle 010: 1 cycle 011: 2 cycles 100: 3 cycles 101: 4 cycles 110: 5 cycles 111: 6 cycles 15 to 13 ? all 0 r reserved these bits are always read as 0. the write value should always be 0.
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 293 of 982 rej09b0023-0400 bit bit name initial value r/w description 12 11 sw1 sw0 0 0 r/w r/w number of delay cycles from address, csn assertion to rd, we assertion specify the number of delay cycles from address and csn assertion to rd and we assertion. 00: 0.5 cycles 01: 1.5 cycles 10: 2.5 cycles 11: 3.5 cycles 10 9 8 7 wr3 wr2 wr1 wr0 1 0 1 0 r/w r/w r/w r/w number of read access wait cycles specify the number of cycles that are necessary for read access. 0000: no cycle 0001: 1 cycle 0010: 2 cycles 0011: 3 cycles 0100: 4 cycles 0101: 5 cycles 0110: 6 cycles 0111: 8 cycles 1000: 10 cycles 1001: 12 cycles 1010: 14 cycles 1011: 18 cycles 1100: 24 cycles 1101: reserved (setting prohibited) 1110: reserved (setting prohibited) 1111: reserved (setting prohibited) 6 wm 0 r/w external wait mask specification specify whether or not the external wait input is valid. the specification by this bit is valid even when the number of access wait cycle is 0. 0: external wait is valid 1: external wait is ignored
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 294 of 982 rej09b0023-0400 bit bit name initial value r/w description 5 to 2 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 1 0 hw1 hw0 0 0 r/w r/w delay cycles from rd, wen negation to address, csn negation specify the number of delay cycles from rd and wen negation to address and csn negation. 00: 0.5 cycles 01: 1.5 cycles 10: 2.5 cycles 11: 3.5 cycles ? cs5bwcr bit bit name initial value r/w description 31 to 22 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 21 szsei 0 r/w mpx-io interfac e bus width specification specifies an address to select the bus width when the bsz[1:0] of cs5bbcr are specified as 11. this bit is valid only when area 5b is specified as mpx-i/o. 0: selects the bus width by address a14 1: selects the bus width by address a21 the relationship between the szsel bit and bus width selected by a14 or a21 are summarized below. szsel a14 a21 bus width 0 0 not affected 8 bits 0 0 not affected 16 bits 1 not affected 0 8 bits 1 not affected 1 16 bits
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 295 of 982 rej09b0023-0400 bit bit name initial value r/w description 20 mpx 0 r/w mpx-io interface address wait specifies the address cycle insertion wait for mpx-io interface. this bit setting is valid only when area 5b is specified as mpx-i/o. 0: inserts no wait cycle 1: inserts 1 wait cycle bas 0 r/w byte-selection sram byte access selection this bit setting is valid only when area 5b is specified as byte-selection sram. specifies the wen and rd/ wr signal timing when the byte-selection sram interface is used. 0: asserts the wen signal at the read timing and asserts the rd/ wr signal during the write access cycle. 1: asserts the wen signal during the read access cycle and asserts the rd/ wr signal at the write timing. 19 ? 0 r reserved this bit is always read as 0. the write value should always be 0. 18 17 16 ww2 ww1 ww0 0 0 0 r/w r/w r/w number of write access wait cycles specify the number of cycles that are necessary for write access. 000: the same cycles as wr[3:0] setting (number of read access wait cycles) 001: no cycle 010: 1 cycle 011: 2 cycles 100: 3 cycles 101: 4 cycles 110: 5 cycles 111: 6 cycles 15 to 13 ? all 0 r reserved these bits are always read as 0. the write value should always be 0.
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 296 of 982 rej09b0023-0400 bit bit name initial value r/w description 12 11 sw1 sw0 0 0 r/w r/w number of delay cycles from address, csn assertion to rd, we assertion specify the number of delay cycles from address and csn assertion to rd and we assertion. 00: 0.5 cycles 01: 1.5 cycles 10: 2.5 cycles 11: 3.5 cycles 10 9 8 7 wr3 wr2 wr1 wr0 1 0 1 0 r/w r/w r/w r/w number of read access wait cycles specify the number of cycles that are necessary for read access. 0000: no cycle 0001: 1 cycle 0010: 2 cycles 0011: 3 cycles 0100: 4 cycles 0101: 5 cycles 0110: 6 cycles 0111: 8 cycles 1000: 10 cycles 1001: 12 cycles 1010: 14 cycles 1011: 18 cycles 1100: 24 cycles 1101: reserved (setting prohibited) 1110: reserved (setting prohibited) 1111: reserved (setting prohibited) 6 wm 0 r/w external wait mask specification specifies whether or not the external wait input is valid. the specification by this bit is valid even when the number of access wait cycle is 0. 0: external wait is valid 1: external wait is ignored
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 297 of 982 rej09b0023-0400 bit bit name initial value r/w description 5 to 2 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 1 0 hw1 hw0 0 0 r/w r/w delay cycles from rd, wen negation to address, csn negation specify the number of delay cycles from rd and wen negation to address and csn negation. 00: 0.5 cycles 01: 1.5 cycles 10: 2.5 cycles 11: 3.5 cycles ? cs6awcr bit bit name initial value r/w description 31 to 13 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 12 11 sw1 sw0 0 0 r/w r/w number of delay cycles from address, csn assertion to rd, we assertion specify the number of delay cycles from address and csn assertion to rd and we assertion. 00: 0.5 cycles 01: 1.5 cycles 10: 2.5 cycles 11: 3.5 cycles
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 298 of 982 rej09b0023-0400 bit bit name initial value r/w description 10 9 8 7 wr3 wr2 wr1 wr0 1 0 1 0 r/w r/w r/w r/w number of access wait cycles specify the number of cycles that are necessary for read/write access. 0000: no cycle 0001: 1 cycle 0010: 2 cycles 0011: 3 cycles 0100: 4 cycles 0101: 5 cycles 0110: 6 cycles 0111: 8 cycles 1000: 10 cycles 1001: 12 cycles 1010: 14 cycles 1011: 18 cycles 1100: 24 cycles 1101: reserved (setting prohibited) 1110: reserved (setting prohibited) 1111: reserved (setting prohibited) 6 wm 0 r/w external wait mask specification specifies whether or not the external wait input is valid. the specification by this bit is valid even when the number of access wait cycle is 0. 0: external wait is valid 1: external wait is ignored 5 to 2 ? all 0 r reserved these bits are always read as 0. the write value should always be 0.
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 299 of 982 rej09b0023-0400 bit bit name initial value r/w description 1 0 hw1 hw0 0 0 r/w r/w delay cycles from rd, wen negation to address, csn negation specify the number of delay cycles from rd and wen negation to address and csn negation. 00: 0.5 cycles 01: 1.5 cycles 10: 2.5 cycles 11: 3.5 cycles ? cs6bwcr bit bit name initial value r/w description 31 to 21 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 20 bas 0 r/w byte-selection sram byte access selection specifies the wen and rd/ wr signal timing when the byte-selection sram interface is used. 0: asserts the wen signal at the read timing and asserts the rd/ wr signal during the write access cycle. 1: asserts the wen signal during the read/write access cycle and asserts the rd/ wr signal at the write timing. 19 to 13 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 12 11 sw1 sw0 0 0 r/w r/w number of delay cycles from address, csn assertion to rd, wen assertion specify the number of del ay cycles from address, csn assertion to rd and wen assertion. 00: 0.5 cycles 01: 1.5 cycles 10: 2.5 cycles 11: 3.5 cycles
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 300 of 982 rej09b0023-0400 bit bit name initial value r/w description 10 9 8 7 wr3 wr2 wr1 wr0 1 0 1 0 r/w r/w r/w r/w number of access wait cycles specify the number of cycles that are necessary for read/write access. 0000: no cycle 0001: 1 cycle 0010: 2 cycles 0011: 3 cycles 0100: 4 cycles 0101: 5 cycles 0110: 6 cycles 0111: 8 cycles 1000: 10 cycles 1001: 12 cycles 1010: 14 cycles 1011: 18 cycles 1100: 24 cycles 1101: reserved (setting prohibited) 1110: reserved (setting prohibited) 1111: reserved (setting prohibited) 6 wn 0 r/w external wait mask specification specifies whether or not the external wait input is valid. the specification of this bit is valid even when the number of access wait cycles is 0. 0: the external wait input is valid. 1: the external wait input is ignored. 5 to 2 ? all 0 r reserved these bits are always read as 0. the write value should always be 0.
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 301 of 982 rej09b0023-0400 bit bit name initial value r/w description 1 0 hw1 hw0 0 0 r/w r/w number of delay cycles from rd, wen negation to address, csn negation specify the number of delay cycles from rd , wen negation to address, and csn negation. 00: 0.5 cycles 01: 1.5 cycles 10: 2.5 cycles 11: 3.5 cycles burst rom (clock asynchronous): ? cs0wcr bit bit name initial value r/w description 31 to 21 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 20 ben 0 r/w burst enable specification enables or disables 8-burst access for a 16-bit bus width or 16-burst access for an 8-bit bus width during 16-byte access. if this bit is set to 0, 2-burst access is performed four times when the bus width is 16 bits and 4-burst access is performed four times when the bus width is 8 bits. to use a device that does not support 8-burst access or 16-burst acce ss, set this bit to 1. 0: enables 8-burst access for a 16-bit bus width and 16-burst access for an 8-bit bus width. 1: disables 8-burst access for a 16-bit bus width and 16-burst access for an 8-bit bus width. 19, 18 ? all 0 r reserved these bits are always read as 0. the write value should always be 0.
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 302 of 982 rej09b0023-0400 bit bit name initial value r/w description 17 16 bw1 bw0 0 0 r/w r/w number of burst wait cycles specify the number of wait cycles to be inserted between the second or later access cycles in burst access. 00: no cycle 01: 1 cycle 10: 2 cycles 11: 3 cycles 15 to 11 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 10 9 8 7 w3 w2 w1 w0 1 0 1 0 r/w r/w r/w r/w number of access wait cycles specify the number of wait cycles to be inserted in the first access cycle. 0000: no cycle 0001: 1 cycle 0010: 2 cycles 0011: 3 cycles 0100: 4 cycles 0101: 5 cycles 0110: 6 cycles 0111: 8 cycles 1000: 10 cycles 1001: 12 cycles 1010: 14 cycles 1011: 18 cycles 1100: 24 cycles 1101: reserved (setting prohibited) 1110: reserved (setting prohibited) 1111: reserved (setting prohibited)
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 303 of 982 rej09b0023-0400 bit bit name initial value r/w description 6 wm 0 r/w external wait mask specification specifies whether or not the external wait input is valid. the specification by this bit is valid even when the number of access wait cycle is 0. 0: external wait is valid 1: external wait is ignored 5 to 0 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. ? cs4wcr bit bit name initial value r/w description 31 to 21 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 20 ben 0 r/w burst enable specification enables or disables 8-burst access for a 16-bit bus width or 16- burst access for an 8-bit bus width during 16-byte access. if this bit is set to 0, 2-burst access is performed four times when the bus width is 16 bits and 4-burst access is performed four times when the bus width is 8 bits. to use a device that does not support 8-burst access or 16-burst acce ss, set this bit to 1. 0: enables 8-burst access for a 16-bit bus width and 16-burst access for an 8-bit bus width. 1: disables 8-burst access for a 16-bit bus width and 16-burst access for an 8-bit bus width. 19, 18 ? all 0 r reserved these bits are always read as 0. the write value should always be 0.
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 304 of 982 rej09b0023-0400 bit bit name initial value r/w description 17 16 bw1 bw0 0 0 r/w r/w number of burst wait cycles specify the number of wait cycles to be inserted between the second or later access cycles in burst access. 00: no cycle 01: 1 cycle 10: 2 cycles 11: 3 cycles 15 to 13 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 12 11 sw1 sw0 0 0 r/w r/w number of delay cycles from address, csn assertion to rd, we assertion specify the number of delay cycles from address and csn assertion to rd and we assertion. 00: 0.5 cycles 01: 1.5 cycles 10: 2.5 cycles 11: 3.5 cycles
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 305 of 982 rej09b0023-0400 bit bit name initial value r/w description 10 9 8 7 w3 w2 w1 w0 1 0 1 0 r/w r/w r/w r/w number of access wait cycles specify the number of wait cycles to be inserted in the first access cycle. 0000: no cycle 0001: 1 cycle 0010: 2 cycles 0011: 3 cycles 0100: 4 cycles 0101: 5 cycles 0110: 6 cycles 0111: 8 cycles 1000: 10 cycles 1001: 12 cycles 1010: 14 cycles 1011: 18 cycles 1100: 24 cycles 1101: reserved (setting prohibited) 1110: reserved (setting prohibited) 1111: reserved (setting prohibited) 6 wm 0 r/w external wait mask specification specifies whether or not the external wait input is valid. the specification by this bit is valid even when the number of access wait cycle is 0. 0: external wait is valid 1: external wait is ignored 5 to 2 ? all 0 r reserved these bits are always read as 0. the write value should always be 0.
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 306 of 982 rej09b0023-0400 bit bit name initial value r/w description 1 0 hw1 hw0 0 0 r/w r/w delay cycles from rd, wen negation to address, csn negation specify the number of delay cycles from rd and wen negation to address and csn negation. 00: 0.5 cycles 01: 1.5 cycles 10: 2.5 cycles 11: 3.5 cycles sdram*: ? cs2wcr bit bit name initial value r/w description 31 to 11 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 10 ? 1 r reserved this bit is always read as 1. the write value should always be 1. 9 ? 0 r reserved this bit is always read as 0. the write value should always be 0. 8 7 a2cl1 a2cl0 1 0 r/w r/w cas latency for area 2 specify the cas latency for area 2. 00: 1 cycle 01: 2 cycles 10: 3 cycles 11: 4 cycles 6 to 0 ? all 0 r reserved these bits are always read as 0. the write value should always be 0.
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 307 of 982 rej09b0023-0400 ? cs3wcr bit bit name initial value r/w description 31 to 15 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 14 13 wtrp1 * wtrp0 0 0 r/w r/w number of auto-precharge completion wait cycles specify the number of minimum precharge completion wait cycles during the periods shown below. ? from the start of auto-pr echarge to issuing of the actv command for the same bank ? from issuing of the pre/pall command to issuing of the actv command for the same bank ? until entering the power-down mode or deep power-down mode ? from issuing of the pall command to issuing of the ref command in auto refreshing ? from issuing of the pall command to issuing of the self command in self refreshing the setting for areas 2 and 3 is common. 00: no cycle 01: 1 cycle 10: 2 cycles 11: 3 cycles 12 ? 0 r reserved this bit is always read as 0. the write value should always be 0. 11 10 wtrcd1 wtrcd0 0 1 r/w r/w number of wait cycles between actv command and read(a)/writ(a) command specify the minimum number of wait cycles from issuing the actv command to issuing the read(a)/writ(a) command. the setting for areas 2 and 3 is common. 00: no cycle 01: 1 cycle 10: 2 cycles 11: 3 cycles
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 308 of 982 rej09b0023-0400 bit bit name initial value r/w description 9 ? 0 r reserved this bit is always read as 0. the write value should always be 0. 8 7 a3cl1 a3cl0 1 0 r/w r/w cas latency for area 3 specify the cas latency for area 3. 00: 1 cycle 01: 2 cycles 10: 3 cycles 11: 4 cycles 6, 5 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 4 3 trwl1 * trwl0 0 0 r/w r/w number of auto-precharge startup wait cycles specify the number of mini mum precharge startup wait cycles during the periods shown below. ? from issuing of the writa command by this lsi to starting of auto-precharge in sdram the number of cycles from issuing the writa command to issuing the actv command for the same bank. see the sdram data sheets to confirm the number of cycl es precede issuing of auto-precharge after the sdram has received the writa command. set these bits so that the confirmed cycles should be equal to or less than the cycles specified by these bits. ? from issuing of the writ command by this lsi to issuing of the pre command when different row addresses are accessed from the same bank address in bank-active mode the setting for areas 2 and 3 is common. 00: no cycle (initial value) 01: 1 cycle 10: 2 cycles 11: 3 cycles
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 309 of 982 rej09b0023-0400 bit bit name initial value r/w description 2 ? 0 r reserved this bit is always read as 0. the write value should always be 0. 1 0 wtrc1 * wtrc0 0 0 r/w r/w number of idle cycles from ref command/self- refresh release to actv/ref/mrs command specify the number of minimum idle cycles during the periods shown below. ? from issuing of the ref command to issuing of the actv/ref/mrs command ? from releasing self-refresh to issuing of the actv/ref/mrs command the setting for areas 2 and 3 is common. 00: 2 cycles (initial value) 01: 3 cycles 10: 5 cycles 11: 8 cycles note: * if both areas 2 and 3 are specified as sdram, wtrp[1:0], wtrcd[1:0], trwl[1:0], and wtrc[1:0] bit settings are common. if onl y one area is connected to the sdram, specify area 3. in this case, specify area 2 as normal space or byte-selection sram. burst mpx-io: ? cs6bwcr bit bit name initial value r/w description 31 to 22 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 21 20 mpxaw1 mpxaw0 0 0 r/w r/w number of address cycle waits specify the number of wa its to be inserted in the address cycle. 00: no cycle 01: 1 cycle 10: 2 cycles 11: 3 cycles
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 310 of 982 rej09b0023-0400 bit bit name initial value r/w description 19 mpxmd 0 r/w burst mpx-io interface mode specification specify the access mode in 16-byte access 0: one 4-burst access by 16-byte transfer 1: two 2-bursts accesses by quad word (8-byte) transfer transfer size when mpxmd = 0 d31 d30 d29 : transfer size 0 0 0 : byte (1 byte) 0 0 1 : word (2 byte) 0 1 0 : longword (4 bytes) 0 1 1 : reserved (quad word) (8 bytes) 1 0 0 : 16 bytes 1 0 1 : reserved (32 bytes) 1 1 0 : reserved (64 bytes) transfer size when mpxmd = 1 d31 d30 d29 : transfer size 0 0 0 : byte (1 byte) 0 0 1 : word (2 byte) 0 1 0 : longword (4 bytes) 0 1 1 : quad word (8 bytes) 1 0 0 : reserved (32 bytes) 18 ? 0 r reserved this bit is always read as 0. the write value should always be 0. 17 16 bw1 bw0 0 1 r/w r/w number of burst wait cycles specify the number of wait cycles to be inserted at the 2nd and the subsequent access cycles in burst access 00: no cycle 01: 1 cycle 10: 2 cycles 11: 3 cycles
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 311 of 982 rej09b0023-0400 bit bit name initial value r/w description 15 to 11 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 10 9 8 7 w3 w2 w1 w0 1 0 1 0 r/w r/w r/w r/w number of access wait cycles specify the number of wait cycles to be inserted in the first access cycle. 0000: no cycle 0001: 1 cycle 0010: 2 cycles 0011: 3 cycles 0100: 4 cycles 0101: 5 cycles 0110: 6 cycles 0111: 8 cycles 1000: 10 cycles 1001: 12 cycles 1010: 14 cycles 1011: 18 cycles 1100: 24 cycles 1101: reserved (setting prohibited) 1110: reserved (setting prohibited) 1111: reserved (setting prohibited) 6 wm 0 r/w external wait mask specification specifies whether or not the external wait input is valid. the specification by this bit is valid even when the number of access wait cycle is 0. 0: external wait is valid 1: external wait is ignored 5 to 0 ? all 0 r reserved these bits are always read as 0. the write value should always be 0.
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 312 of 982 rej09b0023-0400 burst rom (clock synchronous): ? cs0wcr bit bit name initial value r/w description 31 to 18 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 17 16 bw1 bw0 0 0 r/w r/w number of burst wait cycles specify the number of wait cycles to be inserted between the second or later access cycles in burst access. 00: no cycle 01: 1 cycle 10: 2 cycles 11: 3 cycles 15 to 11 ? all 0 r reserved these bits are always read as 0. the write value should always be 0.
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 313 of 982 rej09b0023-0400 bit bit name initial value r/w description 10 9 8 7 w3 w2 w1 w0 1 0 1 0 r/w r/w r/w r/w number of access wait cycles specify the number of wait cycles to be inserted in the first access cycle. 0000: no cycle 0001: 1 cycle 0010: 2 cycles 0011: 3 cycles 0100: 4 cycles 0101: 5 cycles 0110: 6 cycles 0111: 8 cycles 1000: 10 cycles 1001: 12 cycles 1010: 14 cycles 1011: 18 cycles 1100: 24 cycles 1101: reserved (setting prohibited) 1110: reserved (setting prohibited) 1111: reserved (setting prohibited) 6 wm 0 r/w external wait mask specification specifies whether or not the external wait input is valid. the specification by this bit is valid even when the number of access wait cycle is 0. 0: external wait is valid 1: external wait is ignored 5 to 0 ? all 0 r reserved these bits are always read as 0. the write value should always be 0.
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 314 of 982 rej09b0023-0400 12.4.4 sdram control register (sdcr) sdcr specifies the method to refresh and acce ss sdram, and the types of sdrams to be connected. this register is initialized to h'00000000 by a power-on reset, and it is not initialized by a manual reset and in the standby mode. bit bit name initial value r/w description 31 to 21 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 20 19 a2row1 a2row0 0 0 r/w r/w number of bits of row address for area 2 specify the number of bits of row address for area 2. 00: 11 bits 01: 12 bits 10: 13 bits 11: reserved (setting prohibited) 18 ? 0 r reserved this bit is always read as 0. the write value should always be 0. 17 16 a2col1 a2col0 0 0 r/w r/w number of bits of column address for area 2 specify the number of bits of column address for area 2. 00: 8 bits 01: 9 bits 10: 10 bits 11: reserved (setting prohibited) 15, 14 ? all 0 r reserved these bits are always read as 0. the write value should always be 0.
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 315 of 982 rej09b0023-0400 bit bit name initial value r/w description 13 deep 0 r/w deep power-down mode this bit is valid for low-power sdram. if the rfsh or rmode bit is set to 1 while this bit is set to 1, the deep power-down entry command is issued and the low- power sdram enters the deep power-down mode. 0: self-refresh mode 1: deep power-down mode 12 slow 0 r/w low-frequency mode specifies the output timi ng of command, address, and write data for sdram and the latch timing of read data from sdram. setting this bit makes the hold time for command, address, write and read data extended for half cycle (output or read at the falling edge of ckio). this mode is suitable for sdram with low-frequency clock. 0: command, address, and write data for sdram is output at the rising edge of ckio. read data from sdram is latched at the rising edge of ckio. 1: command, address, and write data for sdram is output at the fa lling edge of ckio. read data from sdram is latched at the falling edge of ckio. 11 rfsh 0 r/w refresh control specifies whether or not t he refresh operation of the sdram is performed. 0: no refresh 1: refresh 10 rmode 0 r/w refresh control specifies whether to perform auto-refresh or self- refresh when the rfsh bit is 1. when the rfsh bit is 1 and this bit is 1, self-refresh starts immediately. when the rfsh bit is 1 and this bit is 0, auto-refresh starts according to the conten ts that are set in registers rtcsr, rtcnt, and rtcor. 0: auto-refresh is performed 1: self-refresh is performed
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 316 of 982 rej09b0023-0400 bit bit name initial value r/w description 9 pdown 0 r power-down mode specifies whether the sdram will enter the power- down mode or not after the access to the external memory other than the sdram or to the internal i/o resister. with this bit being set to 1, the access to the external memory other than the sdram or to the internal i/o register driv es the cke signal low and causes the sdram to enter the power-down mode. 0: the sdram does not enter the power-down mode. 1: the sdram enters the power-down mode after the access to the external memory other than the sdram or to the internal i/o resister. 8 bactv 0 r/w bank active mode specifies to access whether in auto-precharge mode (using reada and writa commands) or in bank active mode (using read and writ commands). 0: auto-precharge mode (using reada and writa commands) 1: bank active mode (using read and writ commands) note: bank active mode can be used only when either the upper or lower bits of the cs3 space are used. when both the cs2 and cs3 spaces are set to sdram, specify the auto-precharge mode. 7 to 5 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 4 3 a3row1 a3row0 0 0 r/w r/w number of bits of row address for area 3 specify the number of bits of the row address for area 3. 00: 11 bits 01: 12 bits 10: 13 bits 11: reserved (setting prohibited)
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 317 of 982 rej09b0023-0400 bit bit name initial value r/w description 2 ? 0 r reserved this bit is always read as 0. the write value should always be 0. 1 0 a3col1 a3col0 0 0 r/w r/w number of bits of column address for area 3 specify the number of bits of the column address for area 3. 00: 8 bits 01: 9 bits 10: 10 bits 11: reserved (setting prohibited) 12.4.5 refresh timer contro l/status register (rtcsr) rtcsr specifies various items about refresh fo r sdram. this register is initialized to h'00000000 by a power-on reset, and it is not initialized by a manual reset and in the standby mode. when the rtcsr is written, the upper 16 bits of the write data must be h'a55a to cancel write protection. the clock which counts up the re fresh timer counter (rtcnt) is adjusted its phase only by a power-on reset. thus, when cks[2:0] are set to other than b'000 and a timer is in operation, an error is found until the first compare match flag is set. bit bit name initial value r/w description 31 to 8 ? all 0 r reserved these bits are always read as 0. 7 cmf 0 r/w compare match flag indicates that a compare match occurs between the refresh timer counter (rtcnt) and refresh time constant register (rtcor). this bit is set or cleared in the following conditions. 0: clearing condition: when 0 is written in cmf after reading out rtcsr during cmf = 1. 1: setting condition: when the condition rtcnt = rtcor is satisfied.
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 318 of 982 rej09b0023-0400 bit bit name initial value r/w description 6 ? 0 r reserved this bit is always read as 0. the write value should always be 0. 5 4 3 cks2 cks1 cks0 0 0 0 r/w r/w r/w clock select select the clock input to count-up the refresh timer counter (rtcnt). 000: stop the counting-up 001: b /4 010: b /16 011: b /64 100: b /256 101: b /1024 110: b /2048 111: b /4096 2 1 0 rrc2 rrc1 rrc0 0 0 0 r/w r/w r/w refresh count specify the number of cont inuous refresh cycles, when the refresh request occurs after the coincidence of the values of the refresh ti mer counter (rtcnt) and the refresh time constant register (rtcor). these bits can make the period of occurrence of refresh long. 000: once 001: twice 010: 4 times 011: 6 times 100: 8 times 101: reserved (setting prohibited) 110: reserved (setting prohibited) 111: reserved (setting prohibited)
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 319 of 982 rej09b0023-0400 12.4.6 refresh time r counter (rtcnt) rtcnt is an 8-bit counter that increments using the clock selected by bi ts cks2 to cks0 in rtcsr. when rtcnt matches rtcor, rtcnt is cl eared to 0. the value in rtcnt returns to 0 after counting up to 255. when the rtcnt is wr itten, the upper 16 bits of the write data must be h'a55a to cancel write protection. this counter is initialized to h'00000000 by a power-on reset, and it is not initialized by a manual reset and in the standby mode. bit bit name initial value r/w description 31 to 8 ? all 0 r reserved these bits are always read as 0. 7 to 0 ? all 0 r/w 8-bit counter 12.4.7 refresh time constant register (rtcor) rtcor is an 8-bit register. when rtcor matche s rtcnt, the cmf bit in rtcsr is set to 1 and rtcnt is cleared to 0. when the rfsh bit in sdcr is 1, a memory refr esh request is issued by this matching signal. this request is maintained until the refresh opera tion is performed. if the request is not processed when the next matching occurs, the previous request is ignored. when the rtcor is written, the upper 16 bits of the write data must be h'a55a to cancel write protection. this register is initialized to h'00000000 by a power-on reset, and it is not initialized by a manual reset and in the standby mode. bit bit name initial value r/w description 31 to 8 ? all 0 r reserved these bits are always read as 0. 7 to 0 ? all 0 r/w 8-bit counter
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 320 of 982 rej09b0023-0400 12.4.8 reset wait counter (rwtcnt) rwtcnt is a 7-bit counter. this counter starts to increment by synchronizing the ckio after a power-on reset is released, an d stops when the value reaches h'007f. external bus access is suspended while the counter is operating. this counter is provided to minimize the time from releasing a reset for flash memory to the first access. if a value is written to the lower seven bits of this register, the counter starts to increment from the specified value and the external bus access is suspended until the incrementing has been completed. when the rwtcnt is written, the upper 16 bits of the write data must be h'a55a to cancel write protection. bit bit name initial value r/w description 31 to 7 ? all 0 r reserved these bits are always read as 0. 6 to 0 ? all 0 r/w 7-bit counter
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 321 of 982 rej09b0023-0400 12.5 operating description 12.5.1 endian/access size and data alignment this lsi supports big endian, in which the 0 address is the most significant byte (msbyte) in the byte data. three data bus widths (8 bits, 16 bits, and 32 bits) are available for normal memory and byte- selection sram. two data bus width (16 bits and 32 bits) are available for sdram. data bus width for mpx-io is fixed to 32 bits. data alignment is performed in accordance with the data bus width of the device. this also m eans that when longword data is read from a byte-width device, the read operation must be done four times. in this lsi, data alignment and conversion of data length is performed automatically between the respective interfaces. table 12.5 through 12.7 show the relationship between device data width and access unit. table 12.5 32-bit external device access and data alignment data bus strobe signals operation d31 to d24 d23 to d16 d15 to d8 d7 to d0 we3 , dqmuu we2 , dqmul we1 , dqmlu we0 , dqmll byte access at 0 data 7 to 0 ? ? ? assert ? ? ? byte access at 1 ? data 7 to 0 ? ? ? assert ? ? byte access at 2 ? ? data 7 to 0 ? ? ? assert ? byte access at 3 ? ? ? data 7 to 0 ? ? ? assert word access at 0 data 15 to 8 data 7 to 0 ? ? assert assert ? ? word access at 2 ? ? data 15 to 8 data 7 to 0 ? ? assert assert longword access at 0 data 31 to 24 data 23 to 16 data 15 to 8 data 7 to 0 assert assert assert assert
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 322 of 982 rej09b0023-0400 table 12.6 16-bit external device access and data alignment data bus strobe signals operation d31 to d24 d23 to d16 d15 to d8 d7 to d0 we3 , dqmuu we2 , dqmul we1 , dqmlu we0 , dqmll byte access at 0 ? ? data 7 to 0 ? ? ? assert ? byte access at 1 ? ? ? data 7 to 0 ? ? ? assert byte access at 2 ? ? data 7 to 0 ? ? ? assert ? byte access at 3 ? ? ? data 7 to 0 ? ? ? assert word access at 0 ? ? data 15 to 8 data 7 to 0 ? ? assert assert word access at 2 ? ? data 15 to 8 data 7 to 0 ? ? assert assert 1st time at 0 ? ? data 31 to 24 data 23 to 16 ? ? assert assert longword access at 0 2nd time at 2 ? ? data 15 to 8 data 7 to 0 ? ? assert assert
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 323 of 982 rej09b0023-0400 table 12.7 8-bit external devi ce access and data alignment data bus strobe signals operation d31 to d24 d23 to d16 d15 to d8 d7 to d0 we3 , dqmuu we2 , dqmul we1 , dqmlu we0 , dqmll byte access at 0 ? ? ? data 7 to 0 ? ? ? assert byte access at 1 ? ? ? data 7 to 0 ? ? ? assert byte access at 2 ? ? ? data 7 to 0 ? ? ? assert byte access at 3 ? ? ? data 7 to 0 ? ? ? assert 1st time at 0 ? ? ? data 15 to 8 ? ? ? assert word access at 0 2nd time at 1 ? ? ? data 7 to 0 ? ? ? assert 1st time at 2 ? ? ? data 15 to 8 ? ? ? assert word access at 2 2nd time at 3 ? ? ? data 7 to 0 ? ? ? assert 1st time at 0 ? ? ? data 31 to 24 ? ? ? assert 2nd time at 1 ? ? ? data 23 to 16 ? ? ? assert 3rd time at 2 ? ? ? data 15 to 8 ? ? ? assert longword access at 0 4th time at 3 ? ? ? data 7 to 0 ? ? ? assert
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 324 of 982 rej09b0023-0400 12.5.2 normal space interface basic timing: for access to a normal space, this lsi uses strobe signal output in consideration of the fact that mainly static ram will be directly connected. when using sram with a byte- selection pin, see section 12.5.8, byte-selecti on sram interface. figure 12.3 shows the basic timings of normal space access. a no-wait norm al access is completed in two cycles. the bs signal is asserted for one cycle to indicate the start of a bus cycle. ckio note: * the waveform for dackn is when active low is specified. a25 to a0 rd/wr rd/wr d31 to d0 dackn csn t1 t2 rd wen bs d31 to d0 read write * figure 12.3 normal space basic access timing (access wait 0) there is no access size specification when reading. the correct access start ad dress is output in the least significant bit of the address, but since there is no access size specification, 32 bits are always read in case of a 32-bit device, and 16 bits in case of a 16-bit device. when writing, only the wen signal for the byte to be written is asserted.
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 325 of 982 rej09b0023-0400 it is necessary to output the data that has been read using rd when a buffer is established in the data bus. the rd/ wr signal is in a read state (high output ) when no access has been carried out. therefore, care must be taken when controlling the external data buffer, to avoid collision. figures 12.4 and 12.5 show th e basic timings of normal space accesses. if the wm bit in csnwcr is cleared to 0, a tnop cycle is insert ed after the csn space access to evaluate the external wait (figure 12.4). if the wm bit in cs nwcr is set to 1, external waits are ignored and no tnop cycle is inserted (figure 12.5). ckio a25 to a0 rd rd/wr d15 to d0 wen d15 to d0 dackn bs wait csn t1 t2 tnop t1 t2 read write * note: * the waveform for dackn is when active low is specified. figure 12.4 continuous access for normal space 1 bus width = 16 bits, longword access, csnwcr.wn bit = 0 (access wait = 0, cycle wait = 0)
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 326 of 982 rej09b0023-0400 ckio a25 to a0 rd/wr d15 to d0 dackn csn t1 t2 t1 t2 rd wen bs wait d15 to d0 read write * note: * the waveform for dackn is when active low is specified. figure 12.5 continuous access for normal space 2 bus width = 16 bits, longword access, csnwcr.wn bit = 1 (access wait = 0, cycle wait = 0)
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 327 of 982 rej09b0023-0400      a16 a0 cs oe i/o7 i/o0 we     a18 a2 csn rd d31 d24 we3 d23 d16 we2 d15 d8 we1 d7 d0 we0 this lsi 128k 8-bit sram  a16 a0 cs oe i/o7 i/o0 we      a16 a0 cs oe i/o7 i/o0 we     a16 a0 cs oe i/o7 i/o0 we      figure 12.6 example of 32-bit data-width sram connection
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 328 of 982 rej09b0023-0400 a16 a0 cs oe i/o7 i/o0 we     a17 a1 csn rd d15 d8 we1 d7 d0 we0 this lsi 128k 8-bit sram  a16 a0 cs oe i/o7 i/o0 we         figure 12.7 example of 16-bit data-width sram connection this lsi 128k 8-bit sram a16 a0 cs oe i/o7 i/o0 we . . . a16 a0 csn rd d7 d0 we0 . . . . . . . . . figure 12.8 example of 8-bi t data-width sram connection
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 329 of 982 rej09b0023-0400 12.5.3 access wait control wait cycle insertion on a normal space access can be controlled by the settings of bits wr3 to wr0 in csnwcr. it is possible for areas 4, 5a, and 5b to insert wait cycles independently in read access and in write access. the areas other th an 4, 5a, and 5b have common access wait for read cycle and write cycle. the specified number of tw cycles are inserted as wait cycles in a normal space access shown in figure 12.9. t1 ckio a25 to a0 csn rd/wr rd d31 to d0 wen d31 to d0 bs tw read write t2 dackn* note: * the waveform for dackn is when active low is specified. figure 12.9 wait timing for normal space access (software wait only)
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 330 of 982 rej09b0023-0400 when the wm bit in csnwcr is clear ed to 0, the external wait input wait signal is also sampled. wait pin sampling is shown in figure 12.10. a 2-cycle wait is specified as a software wait. the wait signal is sampled on the falling edge of ckio at the transition from the t1 or tw cycle to the t2 cycle. t1 ckio a25 to a0 csn rd/wr rd d31 to d0 wen d31 to d0 wait tw tw twx t2 read write bs wait states inserted by wait signal dackn* note: * the waveform for dackn is when active low is specified. figure 12.10 wait state timi ng for normal space access (wait state insertion using wait signal)
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 331 of 982 rej09b0023-0400 12.5.4 csn assert period expansion the number of cycles from csn assertion to rd , wen assertion can be specified by setting bits sw1 and sw0 in csnwcr. the number of cycles from rd , wen negation to csn negation can be specified by setting bits hw1 and hw0. therefor e, a flexible interface to an external device can be obtained. figure 12.11 shows an example. a th cycle and a tf cycle are added before and after an ordinary cycle, re spectively. in these cycles, rd and wen are not asserted, while other signals are asserted. the data output is prolonged to the tf cycle, and this prolongation is useful for devices with slow writing operations. t1 ckio a25 to a0 csn rd/wr rd d31 to d0 wen d31 to d0 bs th read write t2 dackn* tf note: * the waveform for dackn is when active low is specified. figure 12.11 csn assert period expansion
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 332 of 982 rej09b0023-0400 12.5.5 mpx-i/o interface access timing for the mpx space is shown below. in the mpx space, cs5b , ah , rd , and wen signals control the accessing. the basic access for th e mpx space consists of 2 cycles of address output followed by an access to a normal space. the bus width for the address output cycle or the data input/output cycle is fixed to 8 bits or 16 bits. alternatively, it can be 8 bits or 16 bits depending on the address to be accessed. output of the addresses d15 to d0 or d7 to d0 is performed from cycle ta2 to cycle ta3. because cycle ta1 has a high-impedance state, co llisions of addresses an d data can be avoided without inserting idle cycles, even in contin uous accesses. address output is increased to 3 cycles by setting the mpxw bit in the cs5bwcr register to 1. the rd/ wr signal is output at the same time as the cs5b signal; it is high in the read cycle and low in the write cycle. the data cycle is the same as that in a normal space access. timing charts are shown in figures 12.12 to 12.14. t1 ckio a25 to a16 csn rd/wr rd d7 to d0 or d15 to d0 wen d7 to d0 or d15 to d0 bs read write t2 dackn* ta1 ta2 ta3 ah address address data data note: * the waveform for dackn is when active low is specified. figure 12.12 access timing for mpx space (address cycle no wait, data cycle no wait)
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 333 of 982 rej09b0023-0400 t1 ckio a25 to a16 csn rd/wr rd d7 to d0 or d15 to d0 wen d7 to d0 or d15 to d0 bs read write t2 dackn* ta1 ta2 ta3 ah address address data data tadw note: * the waveform for dackn is when active low is specified. figure 12.13 access timing for mpx space (address cycle wa it 1, data cycle no wait)
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 334 of 982 rej09b0023-0400 t1 ckio a25 to a16 cs5b rd/wr rd d7 to d0 or d15 to d0 wen d7 to d0 or d15 to d0 bs read write t2 dackn* ta1 ta2 ta3 ah address address data data tadw tw twx wait note: * the waveform for dackn is when active low is specified. figure 12.14 access ti ming for mpx space (address cycle access wait 1, data cycle wait 1, external wait 1)
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 335 of 982 rej09b0023-0400 12.5.6 sdram interface sdram direct connection: the sdram that can be connected to this lsi is a product that has 11/12/13 bits of row address, 8/9/10 bits of column address, 4 or less banks, and uses the a10 pin for setting precharge mode in read and write command cycles. the control signals for direct connection of sdram are rasu , rasl , casu , casl , rd/ wr , dqmuu, dqmul, dqmlu, dqmll, cke, cs2 , and cs3 . all the signals other than cs2 and cs3 are common to all areas, and signals other than cke are valid when cs2 or cs3 is asserted. sdram can be connected to up to 2 spaces. the data bus width of the area that is connected to sdram can be set to 32 or 16 bits. burst read/single write (burst length 1) and burst re ad/burst write (burst length 1) are supported as the sdram operating mode. commands for sdram can be specified by rasu , rasl , casu , casl , rd/ wr , and specific address signals. thes e commands supports: ? nop ? auto-refresh (ref) ? self-refresh (self) ? all banks pre-charge (pall) ? specified bank pre-charge (pre) ? bank active (actv) ? read (read) ? read with pre-charge (reada) ? write (writ) ? write with pre-charge (writa) ? write mode register (mrs) ? emrs the byte to be accessed is specified by dq muu, dqmul, dqmlu, and dqmll. reading or writing is performed for a byte whose corresponding dqmxx is low. for details on the relationship between dqmxx and the byte to be accessed, refer to section 12.5.1, endian/access size and data alignment.
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 336 of 982 rej09b0023-0400 figures 12.15 to 12.17 show examples of the connection of the sdram with the lsi. as shown in figure 12.17, two sets of sdrams of 32 mbytes or smaller can be connected to the same cs space by using rasu , rasl , casu , and casl . in this case, a total of 8 banks are assigned to the same cs space: 4 banks specified by rasl and casl , and 4 banks specified by ras and cas . when accessing the address with a25 = 0, rasl and casl are asserted. when accessing the address with a25 = 1, rasu and casu are asserted. a15 a2 cke ckio csn rasu casu rasl casl rd/wr d31 d16 dqmuu dqmul d15 d0 dqmlu dqmll 64m sdram (1m 16-bit 4-bank) . . . a13 a0 cke clk cs ras cas we i/o15 i/o0 dqmu dqml . . . . . . . . . . . . a13 a0 cke clk cs ras cas we i/o15 i/o0 dqmu dqml . . . . . . this lsi unused unused figure 12.15 example of 32-bit data width sdram connection ( rasu and casu are not used)
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 337 of 982 rej09b0023-0400 a14 a1 cke ckio csn rasu casu rasl casl rd/wr d15 d0 dqmlu dqmll 64m sdram (1m 16-bit 4-bank) . . . a13 a0 cke clk cs ras cas we i/o15 i/o0 dqmu dqml . . . . . . . . . this lsi unused unused figure 12.16 example of 16-bit data width sdram connection ( rasu and casu are not used)
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 338 of 982 rej09b0023-0400 a14 a1 cke ckio csn rasu casu rasl casl rd/wr d15 d16 dqmlu dqmll 64m sdram (1m 16-bit 4-bank) a13 a0 cke clk cs ras cas we i/o15 i/o0 dqmu dqml . . . . . . . . . . . . a13 a0 cke clk cs ras cas we i/o15 i/o0 dqmu dqml . . . . . . this lsi figure 12.17 example of 16-bit data width sdram connection ( rasu and casu are used)
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 339 of 982 rej09b0023-0400 address multiplexing: an address multiplexing is specified so that sdram can be connected without external multiplexing circuitry according to the setting of bits bsz1 and bsz0 in csnbcr, axrow[1:0] and axcol[1:0] in sdcr. ta bles 12.8 to 12.13 show the relationship between the settings of bits bsz1 and bsz0, axrow[1:0], and axcol[1:0] and the bits output at the address pins. do not specify those bits in the manner other than this table, otherwise the operation of this lsi is not guaranteed. a25 to a1 8 are not multiplexed and the original values of address are always output at these pins. when the data bus width is 16 bits (bsz1 and bsz0 = b'10), a0 of sdram specifies a word address. therefore, connect this a0 pin of sdram to the a1 pin of the lsi; the a1 pin of sdram to the a2 pin of the lsi, and so on. when the data bus width is 32 bits (bsz1 and bsz0 = b'11), the a0 pin of sdram specifies a longwor d address. therefore, co nnect this a0 pin of sdram to the a2 pin of the lsi; the a1 pin of sdram to the a3 pin of the lsi, and so on.
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 340 of 982 rej09b0023-0400 table 12.8 relationship between bsz1, 0, a2/3row1, 0, and address multiplex output (1)-1 setting bsz 1, 0 a2/3 row 1, 0 a2/3 col 1, 0 11 (32 bits) 00 (11 bits) 00 (8 bits) output pin of this lsi row address output cycle column address output cycle sdram pin function a17 a25 a17 a16 a24 a16 a15 a23 a15 unused a14 a22* 2 a22 * 2 a12 (ba1) a13 a21* 2 a21 * 2 a11 (ba0) specifies bank a12 a20* 2 l/h * 1 a10/ap specifies address/precharge a11 a19 a11 a9 a10 a18 a10 a8 a9 a17 a9 a7 a8 a16 a8 a6 a7 a15 a7 a5 a6 a14 a6 a4 a5 a13 a5 a3 a4 a12 a4 a2 a3 a11 a3 a1 a2 a10 a2 a0 address a1 a9 a1 a0 a8 a0 unused example of connected memory 64-mbit product (512 kwords 32 bits 4 banks, column 8 bits product): 1 16-mbit product (512 kwords 16 bits 2 banks, column 8 bits product): 2 notes: 1. l/h is a bit used in the command specification; it is fixed at l or h according to the access mode. 2. bank address specification
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 341 of 982 rej09b0023-0400 table 12.8 relationship between bsz1, 0, a2/3row1, 0, and address multiplex output (1)-2 setting bsz 1, 0 a2/3 row 1, 0 a2/3 col 1, 0 11 (32 bits) 00 (11 bits) 00 (8 bits) output pin of this lsi row address output cycle column address output cycle sdram pin function a17 a25 a17 a16 a24 a16 a15 a23* 2 a23 * 2 unused a14 a22* 2 a22 * 2 a13 (ba1) a13 a21 a13 a12 (ba0) specifies bank a12 a20* 2 l/h * 1 a10/ap specifies address/precharge a11 a19 a11 a9 a10 a18 a10 a8 a9 a17 a9 a7 a8 a16 a8 a6 a7 a15 a7 a5 a6 a14 a6 a4 a5 a13 a5 a3 a4 a12 a4 a2 a3 a11 a3 a1 a2 a10 a2 a0 address a1 a9 a1 a0 a8 a0 unused example of connected memory 128-mbit product (1 mword 32 bits 4 banks, column 8 bits product): 1 64-mbit product (1 mword 16 bits 4 banks, column 8 bits product): 2 notes: 1. l/h is a bit used in the command specification; it is fixed at l or h according to the access mode. 2. bank address specification
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 342 of 982 rej09b0023-0400 table 12.9 relationship between bsz1, 0, a2/3row1, 0, and address multiplex output (2)-1 setting bsz 1, 0 a2/3 row 1, 0 a2/3 col 1, 0 11 (32 bits) 00 (11 bits) 00 (8 bits) output pin of this lsi row address output cycle column address output cycle sdram pin function a17 a26 a17 a16 a25 a16 unused a15 a24* 2 a24 * 2 a13 (ba1) a14 a23* 2 a23 * 2 a12 (ba0) specifies bank a13 a22 a13 a11 address a12 a21 l/h * 1 a10/ap specifies address/precharge a11 a20* 2 a11 a9 a10 a19 a10 a8 a9 a18 a9 a7 a8 a17 a8 a6 a7 a16 a7 a5 a6 a15 a6 a4 a5 a14 a5 a3 a4 a13 a4 a2 a3 a12 a3 a1 a2 a11 a2 a0 address a1 a10 a1 a0 a9 a0 unused example of connected memory 256-mbit product (2 mwords 32 bits 4 banks, column 9 bits product): 1 128-mbit product (2 mwords 16 bits 4 banks, column 9 bits product): 2 notes: 1. l/h is a bit used in the command specification; it is fixed at l or h according to the access mode. 2. bank address specification 3. only the rasl pin is asserted because the a25 pin specified the bank address. rasu is not asserted.
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 343 of 982 rej09b0023-0400 table 12.9 relationship between bsz1, 0, a2/3row1, 0, and address multiplex output (2)-2 setting bsz 1, 0 a2/3 row 1, 0 a2/3 col 1, 0 11 (32 bits) 00 (11 bits) 00 (8 bits) output pin of this lsi row address output cycle column address output cycle sdram pin function a17 a27 a17 a16 a26 a16 unused a15 a25* 2 a25 * 2 * 3 a13 (ba1) a14 a24* 2 a24 * 2 a12 (ba0) specifies bank a13 a23 a13 a11 address a12 a22 l/h * 1 a10/ap specifies address/precharge a11 a21 a11 a9 a10 a20* 2 a10 a8 a9 a19 a9 a7 a8 a18 a8 a6 a7 a17 a7 a5 a6 a16 a6 a4 a5 a15 a5 a3 a4 a14 a4 a2 a3 a13 a3 a1 a2 a12 a2 a0 address a1 a11 a1 a0 a10 a0 unused example of connected memory 512-mbit product (4 mwords 32 bits 4 banks, column 10 bits product): 1 256-mbit product (4 mwords 16 bits 4 banks, column 10 bits product): 2 notes: 1. l/h is a bit used in the command specification; it is fixed at l or h according to the access mode. 2. bank address specification 3. only the rasl pin is asserted because the a25 pin specified the bank address. rasu is not asserted.
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 344 of 982 rej09b0023-0400 table 12.10 relationship between bsz1, 0, a2/3row1, 0, and address multiplex output (3) setting bsz 1, 0 a2/3 row 1, 0 a2/3 col 1, 0 11 (32 bits) 00 (11 bits) 00 (8 bits) output pin of this lsi row address output cycle column address output cycle sdram pin function a17 a26 a17 unused a16 a25* 2 * 3 a25 * 2 a14 (ba1) a15 a24* 2 a24 * 2 a13 (ba0) specifies bank a14 a23 a14 a12 a13 a22 a13 a11 address a12 a21 l/h * 1 a10/ap specifies address/precharge a11 a20* 2 a11 a9 a10 a19 a10 a8 a9 a18 a9 a7 a8 a17 a8 a6 a7 a16 a7 a5 a6 a15 a6 a4 a5 a14 a5 a3 a4 a13 a4 a2 a3 a12 a3 a1 a2 a11 a2 a0 address a1 a10 a1 a0 a9 a0 unused example of connected memory 512-mbit product (4 mwords 32 bits 4 banks, column 9 bits product): 1 256-mbit product (4 mwords 16 bits 4 banks, column 9 bits product): 2 notes: 1. l/h is a bit used in the command specification; it is fixed at l or h according to the access mode. 2. bank address specification 3. only the rasl pin is asserted because the a 25 pin specified the bank address. rasu is not asserted.
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 345 of 982 rej09b0023-0400 table 12.11 relationship between bsz1, 0, a2/3row1, 0, and address multiplex output (4)-1 setting bsz 1, 0 a2/3 row 1, 0 a2/3 col 1, 0 11 (32 bits) 00 (11 bits) 00 (8 bits) output pin of this lsi row address output cycle column address output cycle sdram pin function a17 a25 a17 a16 a24 a16 a15 a23 a15 a14 a22 a14 unused a13 a21* 2 a21 * 2 a12 (ba1) a12 a20* 2 a20 * 2 a11 (ba0) specifies bank a11 a19 l/h * 1 a10/ap specifies address/precharge a10 a18 a10 a9 a9 a17 a9 a8 a8 a16 a8 a7 a7 a15 a7 a6 a6 a14 a6 a5 a5 a13 a5 a4 a4 a12 a4 a3 a3 a11 a3 a2 a2 a10 a2 a1 a1 a9 a1 a0 address a0 a8 a0 unused example of connected memory 16-mbit product (512 kwords 16 bits 2 banks, column 8 bits product): 1 notes: 1. l/h is a bit used in the command specification; it is fixed at l or h according to the access mode. 2. bank address specification
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 346 of 982 rej09b0023-0400 table 12.11 relationship between bsz1, 0, a2/3row1, 0, and address multiplex output (4)-2 setting bsz 1, 0 a2/3 row 1, 0 a2/3 col 1, 0 11 (32 bits) 00 (11 bits) 00 (8 bits) output pin of this lsi row address output cycle column address output cycle sdram pin function a17 a25 a17 a16 a24 a16 a15 a23 a15 unused a14 a22* 2 a22 * 2 a13 (ba1) a13 a21* 2 a21 * 2 a12 (ba0) a12 a20 a20 a11 specifies bank address a11 a19 l/h * 1 a10/ap specifies address/precharge a10 a18 a10 a9 a9 a17 a9 a8 a8 a16 a8 a7 a7 a15 a7 a6 a6 a14 a6 a5 a5 a13 a5 a4 a4 a12 a4 a3 a3 a11 a3 a2 a2 a10 a2 a1 a1 a9 a1 a0 address a0 a8 a0 unused example of connected memory 64-mbit product (1 mword 16 bits 4 banks, column 8 bits product): 1 notes: 1. l/h is a bit used in the command specification; it is fixed at l or h according to the access mode. 2. bank address specification
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 347 of 982 rej09b0023-0400 table 12.12 relationship between bsz1, 0, a2/3row1, 0, and address multiplex output (5)-1 setting bsz 1, 0 a2/3 row 1, 0 a2/3 col 1, 0 11 (32 bits) 00 (11 bits) 00 (8 bits) output pin of this lsi row address output cycle column address output cycle sdram pin function a17 a26 a17 a16 a25 a16 a15 a24 a15 unused a14 a23 a23 * 2 a13 (ba1) a13 a22* 2 a22 * 2 a12 (ba0) specifies bank a12 a21* 2 a12 a11 address a11 a20 l/h * 1 a10/ap specifies address/precharge a10 a19 a10 a9 a9 a18 a9 a8 a8 a17 a8 a7 a7 a16 a7 a6 a6 a15 a6 a5 a5 a14 a5 a4 a4 a13 a4 a3 a3 a12 a3 a2 a2 a11 a2 a1 a1 a10 a1 a0 address a0 a9 a0 unused example of connected memory 128-mbit product (2 mwords 16 bits 4 banks, column 9 bits product): 1 notes: 1. l/h is a bit used in the command specification; it is fixed at l or h according to the access mode. 2. bank address specification
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 348 of 982 rej09b0023-0400 table 12.12 relationship between bsz1, 0, a2/3row1, 0, and address multiplex output (5)-2 setting bsz 1, 0 a2/3 row 1, 0 a2/3 col 1, 0 11 (32 bits) 00 (11 bits) 00 (8 bits) output pin of this lsi row address output cycle column address output cycle sdram pin function a17 a27 a17 a16 a26 a16 a15 a25 a15 unused a14 a24* 2 a24 * 2 a13 (ba1) a13 a23* 2 a23 * 2 a12 (ba0) specifies bank a12 a22 a12 a11 address a11 a21 l/h * 1 a10/ap specifies address/precharge a10 a20 a10 a9 a9 a19 a9 a8 a8 a18 a8 a7 a7 a17 a7 a6 a6 a16 a6 a5 a5 a15 a5 a4 a4 a14 a4 a3 a3 a13 a3 a2 a2 a12 a2 a1 a1 a11 a1 a0 address a0 a10 a0 unused example of connected memory 256-mbit product (4 mwords 16 bits 4 banks, column 10 bits product): 1 notes: 1. l/h is a bit used in the command specification; it is fixed at l or h according to the access mode. 2. bank address specification
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 349 of 982 rej09b0023-0400 table 12.13 relationship between bsz1, 0, a2/3row1, 0, and address multiplex output (6)-1 setting bsz 1, 0 a2/3 row 1, 0 a2/3 col 1, 0 11 (32 bits) 00 (11 bits) 00 (8 bits) output pin of this lsi row address output cycle column address output cycle sdram pin function a17 a26 a17 a16 a25 a16 unused a15 a24* 2 a24 * 2 a14 (ba1) a14 a23* 2 a23 * 2 a13 (ba0) specifies bank a13 a22 a13 a12 a12 a21 a12 a11 address a11 a20* 2 l/h * 1 a10/ap specifies address/precharge a10 a19 a10 a9 a9 a18 a9 a8 a8 a17 a8 a7 a7 a16 a7 a6 a6 a15 a6 a5 a5 a14 a5 a4 a4 a13 a4 a3 a3 a12 a3 a2 a2 a11 a2 a1 a1 a10 a1 a0 address a0 a9 a0 unused example of connected memory 256-mbit product (4 mwords 16 bits 4 banks, column 9 bits product): 1 notes: 1. l/h is a bit used in the command specification; it is fixed at l or h according to the access mode. 2. bank address specification 3. only the rasl pin is asserted because the a25 pin specified the bank address. rasu is not asserted.
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 350 of 982 rej09b0023-0400 table 12.13 relationship between bsz1, 0, a2/3row1, 0, and address multiplex output (6)-2 setting bsz 1, 0 a2/3 row 1, 0 a2/3 col 1, 0 11 (32 bits) 00 (11 bits) 00 (8 bits) output pin of this lsi row address output cycle column address output cycle sdram pin function a17 a27 a17 a16 a26 a16 unused a15 a25* 2 a25 * 2 * 3 a14 (ba1) a14 a24* 2 a24 * 2 a13 (ba0) specifies bank a13 a23 a13 a12 a12 a22 a12 a11 address a11 a21 l/h * 1 a10/ap specifies address/precharge a10 a20* 2 a10 a9 a9 a19 a9 a8 a8 a18 a8 a7 a7 a17 a7 a6 a6 a16 a6 a5 a5 a15 a5 a4 a4 a14 a4 a3 a3 a13 a3 a2 a2 a12 a2 a1 a1 a11 a1 a0 address a0 a10 a0 unused example of connected memory 512-mbit product (8 mwords 16 bits 4 banks, column 10 bits product): 1 notes: 1. l/h is a bit used in the command specification; it is fixed at l or h according to the access mode. 2. bank address specification 3. only the rasl pin is asserted because the a25 pin specified the bank address. rasu is not asserted.
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 351 of 982 rej09b0023-0400 burst read: a burst read occurs in the fo llowing cases with this lsi. ? access size in reading is larger than data bus width. ? 16-byte transfer in cache error. ? 16-byte transfer in dmac this lsi always accesses the sdram with burst length 1. for example, read access of burst length 1 is performed consecutively 4 times to read 16-byte continuous data from the sdram that is connected to a 32-bit data bus. table 12.14 shows the relatio nship between the access size an d the number of bursts. table 12.14 relationship between access size and number of bursts bus width access size number of bursts 16 bits 8 bits 1 16 bits 1 32 bits 2 16 bits 8 32 bits 8 bits 1 16 bits 1 32 bits 1 16 bits 4 figures 12.18 and 12.19 show a timing chart in bu rst read. in burst read, an actv command is output in the tr cycle, the read command is issued in the tc1, tc2, and tc3 cycles, the reada command is issued in the tc4 cycle, and the read data is received at the rising edge of the external clock (ckio) in the td1 to td4 cycles. the tap cy cle is used to wait for the completion of an auto-precharge induced by th e reada command in the sdram. in the tap cycle, a new command will not be issued to the same bank. however, access to another cs space or another bank in the same sdram space is enabled. the number of tap cycles is specified by the wtrp1 and wtrp0 bits in the cs3wcr register. in this lsi, wait cycles can be inserted by sp ecifying each bit in the cs 3wcr register to connect the sdram in variable frequencies. figure 12 .19 shows an example in which wait cycles are inserted. the number of cycles from the tr cycle where the actv command is output to the tc1 cycle where the read command is output can be specified using the wtrcd1 and wtrcd0 bits in the cs3wcr register. if the wtrcd1 and wtrcd0 bits specify one cycles or more, a trw cycle where the not command is issued is inserted between the tr cycle and tc1 cycle. the
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 352 of 982 rej09b0023-0400 number of cycles from the tc1 cycle where the read command is output to the td1 cycle where the read data is latched can be specified fo r the cs2 and cs3 spaces independently, using the a2cl1 and a2cl0 bits in the cs2wcr register or the a3cl1 and a3cl0 bits in the cs3wcr register and wtrcd0 bit in the cs3wcr register. the number of cycles from tc1 to td1 corresponds to the sdram cas latency. the cas latency for the sdram is normally defined as up to three cycles. however, the cas latency in this lsi can be specified as 1 to 4 cycles. this cas latency can be achieved by connecting a latch circuit between this lsi and the sdram. a tde cycle is an idle cycle required to transfer the read data into this lsi and occurs once for every burst read or every single read. tc4 ckio a25 to a0 csn rd/wr rasl, rasu dqmxx d31 to d0 bs (tap) dackn* 2 tr tc2 tc3 tc1 td4 tde td2 td3 td1 a12/a11* 1 casl, casu notes: 1. address pin to be connected to pin a10 of sdram. 2. the waveform for dackn is when active low is specified. figure 12.18 burst read basic timing (cas latency 1, auto pre-charge)
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 353 of 982 rej09b0023-0400 tc4 (tap) tr tc2 tc3 tc1 td4 tde td2 td3 td1 trw tw ckio a25 to a0 csn rd/wr rasl, rasu dqmxx d31 to d0 bs dackn* 2 a12/a11* 1 casl, casu notes: 1. address pin to be connected to pin a10 of sdram. 2. the waveform for dackn is when active low is specified. figure 12.19 burst read wait specification timing (cas latency 2, wtrcd1 and wtrcd0 = 1 cycle, auto pre-charge)
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 354 of 982 rej09b0023-0400 single read: a read access ends in one cycle when data exists in non-cacheab le region and the data bus width is larger than or equal to access size. as the burst length is set to 1 in synchronous dram burst read/single write mode, only the required data is output. figure 12.20 shows the single read basic timing. tap tr tc1 tde td1 ckio a25 to a0 csn rd/wr rasl, rasu dqmxx d31 to d0 bs dackn* 2 a12/a11* 1 casl, casu notes: 1. address pin to be connected to pin a10 of sdram. 2. the waveform for dackn is when active low is specified. figure 12.20 basic timing for single read (cas latency 1, auto pre-charge)
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 355 of 982 rej09b0023-0400 burst write: a burst write occurs in the fo llowing cases in this lsi. ? access size in writing is larger than data bus width. ? write-back of the cache ? 16-byte transfer in dmac this lsi always accesses sdram wi th burst length 1. for example, write access of burst length 1 is performed continuously 4 times to write 16-byte continuous data to the sdram that is connected to a 32-bit data bus. the relationship between the access size and the nu mber of bursts is shown in table 12.14. figure 12.21 shows a timing chart for burst writes. in burst write, an actv command is output in the tr cycle, the writ command is issued in the tc1, tc2, and tc3 cycles, and the writa command is issued to execute an auto-precharge in the tc4 cycle. in the write cycle, the write data is output simultaneously with the write comm and. after the write command with the auto- precharge is output, the trw1 cycle that waits for the auto-precharge initiation is followed by the tap cycle that waits for completion of the auto-p recharge induced by the writa command in the sdram. between the trwl and the tap cycle, a new command will not be issued to the same bank. however, access to another cs space or anot her bank in the same sdram space is enabled. the number of trw1 cycles is specified by the trwl1 and trwl0 bits in the cs3wcr register. the number of tap cycles is specified by the wtrp1 and wtrp0 bits in the cs3wcr register.
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 356 of 982 rej09b0023-0400 tc4 tap tr tc2 tc3 tc1 trwl ckio a25 to a0 csn rd/wr rasl, rasu dqmxx d31 to d0 bs dackn* 2 a12/a11* 1 casl, casu notes: 1. address pin to be connected to pin a10 of sdram. 2. the waveform for dackn is when active low is specified. figure 12.21 basic timing fo r burst write (auto pre-charge)
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 357 of 982 rej09b0023-0400 single write: a write access ends in one cycle when data is written in non-cacheable region and the data bus width is larger than or equal to access size. figure 12.22 shows the single write basic timing. tap tr tc1 trwl ckio a25 to a0 csn rd/wr rasl, rasu dqmxx d31 to d0 bs dackn* 2 a12/a11* 1 casl, casu notes: 1. address pin to be connected to pin a10 of sdram. 2. the waveform for dackn is when active low is specified. figure 12.22 single write ba sic timing (auto-precharge)
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 358 of 982 rej09b0023-0400 bank active: the synchronous dram bank function is used to support high-speed accesses to the same row address. when the bactv bit in sdcr is 1, accesses are performed using commands without auto-precharge (read or writ). this function is called bank-active function. this function is valid only for either the upper or lower bits of area 3. when area 3 is set to bank- active mode, area 2 should be set to normal space. when areas 2 an d 3 are both set to sdram or both the upper and lower bits of area 3 are connected to sdram, au to pre-charge mode must be set. in this case, precharging is not performed when the access ends. when accessing the same row address in the same bank, it is possible to i ssue the read or writ command immediately, without issuing an actv command. as synchronous dram is internally divided into several banks, it is possible to activate one row address in each bank. if the next access is to a different row address, a pre command is first issued to pr echarge the relevant bank, then when precharging is completed, the access is perf ormed by issuing an actv comm and followed by a read or writ command. if this is followed by an access to a different row address, the access time will be longer because of the precharging performed af ter the access request is issued. the number of cycles between issuance of the pre command an d the actv command is determined by the wtrp1 and wtpr0 bits in cs3wcr. in a write, when an auto-precharge is performed, a command cannot be issued to the same bank for a period of trwl + tap cycles after issuan ce of the writa command. when bank active mode is used, read or writ commands can be issued successively if the row ad dress is the same. the number of cycles can thus be reduced by trwl + tap cycles for each write. there is a limit on tras, the time for placing each bank in the active state. if there is no guarantee that there will not be a cache hit and another row address will be accessed within the period in which this value is maintained by program execution, it is necessary to set auto-refresh and set the refresh cycle to no more than the maximum value of tras. a burst read cycle without auto-precharge is shown in figure 12.23, a burst read cycle for the same row address in figure 12.24, and a burst read cy cle for different row addresses in figure 12.25. similarly, a burst write cycle without auto-precharge is shown in figure 12.26, a burst write cycle for the same row address in figure 12.27, and a burst write cycle for different row addresses in figure 12.28. in figure 12.24, a tnop cycle in which no operation is performed is inserted before the tc cycle that issues the read command. the tnop cycle is inserted to ac quire two cycles of cas latency for the dqmxx signal that specifies the read byte in the data read from the sdram. if the cas latency is specified as two cycles or more, the tnop cycle is not inserted because the two cycles of latency can be acquired even if the dqmxx signal is asserted after the tc cycle.
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 359 of 982 rej09b0023-0400 when bank active mode is set, if only accesse s to the respective banks in the area 3 space are considered, as long as accesses to the same row address co ntinue, the operation starts with the cycle in figure 12.23 or 12.26, followed by repe tition of the cycle in figure 12.24 or 12.27. an access to a different area during this time has no effect. if there is an access to a different row address in the bank active state, after this is detected the bus cy cle in figure 12.24 or 12.27 is executed instead of that in figure 12.25 or 12.28. in bank active mode, too, all banks become inactive after a refresh cycle or after the bus is released as the result of bus arbitration. tc4 tr tc2 tc3 tc1 td4 td2 td3 td1 tde ckio a25 to a0 csn rd/wr rasl, rasu dqmxx d31 to d0 bs dackn* 2 a12/a11* 1 casl, casu notes: 1. address pin to be connected to pin a10 of sdram. 2. the waveform for dackn is when active low is specified. figure 12.23 burst read timing (ba nk active, different bank, cas latency 1)
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 360 of 982 rej09b0023-0400 tc4 tc2 tc3 tc1 tnop td4 tde td2 td3 td1 ckio a25 to a0 csn rd/wr rasl, rasu dqmxx d31 to d0 bs dackn* 2 a12/a11* 1 casl, casu notes: 1. address pin to be connected to pin a10 of sdram. 2. the waveform for dackn is when active low is specified. figure 12.24 burst read timing (bank active, same row addresses in the same bank, cas latency 1)
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 361 of 982 rej09b0023-0400 tc4 tpw tp tc2 tc3 tc1 td4 td2 td3 td1 tde tr ckio a25 to a0 csn rd/wr rasl, rasu dqmxx d31 to d0 bs dackn* 2 a12/a11* 1 casl, casu notes: 1. address pin to be connected to pin a10 of sdram. 2. the waveform for dackn is when active low is specified. figure 12.25 burst read timing (bank active, different row addresses in the same bank, cas latency 1)
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 362 of 982 rej09b0023-0400 tr tc1 ckio a25 to a0 csn rd/wr rasl, rasu dqmxx d31 to d0 bs dackn* 2 a12/a11* 1 casl, casu notes: 1. address pin to be connected to pin a10 of sdram. 2. the waveform for dackn is when active low is specified. figure 12.26 single write timi ng (bank active, different bank)
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 363 of 982 rej09b0023-0400 tnop tc1 ckio a25 to a0 csn rd/wr rasl, rasu dqmxx d31 to d0 bs dackn* 2 a12/a11* 1 casl, casu notes: 1. address pin to be connected to pin a10 of sdram. 2. the waveform for dackn is when active low is specified. figure 12.27 single write timing (bank ac tive, same row addresses in the same bank)
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 364 of 982 rej09b0023-0400 tpw tp tc1 tr ckio a25 to a0 csn rd/wr rasl, rasu dqmxx d31 to d0 bs dackn* 2 a12/a11* 1 casl, casu notes: 1. address pin to be connected to pin a10 of sdram. 2. the waveform for dackn is when active low is specified. figure 12.28 single write timing (bank active, different row addresses in the same bank) refreshing: this lsi has a function for controlling synchronous dram refreshing. auto- refreshing can be performed by clearing the rmode bit to 0 and setting the rfsh bit to 1 in sdcr. a continuous refreshing can be performed by setting the rrc2 to rrc0 bits in rtcsr. if synchronous dram is not accessed for a long period, self-refresh mode, in which the power consumption for data retention is low, can be activated by setting both the rmode bit and the rfsh bit to 1.
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 365 of 982 rej09b0023-0400 1. auto-refreshing refreshing is performed at intervals determined by the input clock selected by bits cks2 to cks0 in rtcsr, and the value set by in rt cor. the value of bits cks2 to cks0 in rtcor should be set so as to satisfy the refresh interval stipulation for the synchronous dram used. first make the settings for rtcor, rtcnt, and the rmode and rfsh bits in sdcr, then make the cks2 to cks0 and rrc2 to rrc0 settings. when the clock is selected by bits cks2 to cks0, rtcnt starts counting up from the value at that time. the rtcnt value is constantly compared with the rtcor value, and if the two values are the same, a refresh request is generated and an auto-refresh is performed for the number of times specified by the rrc2 to rrc0. at the same time, rtcn t is cleared to zero and the count-up is restarted. figure 12.29 shows the auto-refresh cycle timing. after starting, the auto refreshing, pall command is issued in the tp cycle to make all the banks to pre-charged state from active state when some bank is being pre-charged. then ref command is issued in the trr cycl e after inserting idle cycles of which number is specified by the wtrp1 and wtrp0 bits in cs3wcr. a new command is not issued for the duration of the number of cycles specified by the wtrc1 and wtrc0 bits in cs3wcr after the trr cycle. the wtrc1 and wtrc0 bits must be set so as to satisfy the sdram refreshing cycle time stipulation (trc). an idle cycle is inserted between the tp cycle and trr cycle when the setting value of the wtrp1 and wtrp0 bits in cs3wcr is longer than or equal to 1 cycle.
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 366 of 982 rej09b0023-0400 tpw tp trr trc trc trc hi-z ckio a25 to a0 csn rd/wr rasl, rasu dqmxx d31 to d0 bs dackn* 2 a12/a11* 1 casl, casu notes: 1. address pin to be connected to pin a10 of sdram. 2. the waveform for dackn is when active low is specified. figure 12.29 auto-refresh timing 2. self-refreshing self-refresh mode in which the refresh timing and refresh addresses are generated within the synchronous dram. self-refreshing is activated by setting both the rmode bit and the rfsh bit in sdcr to 1. after starting the self-refreshing, pall command is issued in tp cycle after the completion of th e pre-charging bank. a self command is then issued after inserting idle cycles of which number is specified by the wtrp1 and wtrp0 bits in cs3wsr. synchronous dram cannot be accessed wh ile in the self-refresh state. self-refresh mode is cleared by clearing the rmode bit to 0. after self-refresh mode has been cleared, command issuance is disabled fo r the number of cycles speci fied by the wtrc1 and wtrc0 bits in cs3wcr.
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 367 of 982 rej09b0023-0400 self-refresh timing is shown in figure 12.30. settings must be made so that self-refresh clearing and data retention are performed correctly, and auto-refreshing is performed at the correct intervals. when self-re freshing is activated from the st ate in which auto-refreshing is set, or when exiting standby mode other than through a power-on reset, auto-refreshing is restarted if the rfsh bit is set to 1 and the rm ode bit is cleared to 0 when self-refresh mode is cleared. if the transition from clearing of self-refresh mode to the start of auto-refreshing takes time, this time should be taken into c onsideration when setting the initial value of rtcnt. making the rtcnt value 1 less than the rtcor value will enable refreshing to be started immediately. after self-refreshing has been set, the self-refresh state continues even if the chip standby state is entered using the lsi standby function, and is maintained even after recovery from standby mode. note that the hizcnt bit in the cmncr register needs to be set to 1 and pins such as cke are driven in standby mode. the self-refresh state cannot be clear ed through a manual reset. in case of a power-on reset, the bus st ate controller's registers are initialized, and therefore the self-refresh state is cleared. tpw tp trr trc trc trc hi-z trc ckio cke a25 to a0 csn rd/wr rasl, rasu dqmxx d31 to d0 bs dackn* 2 a12/a11* 1 casl, casu notes: 1. address pin to be connected to pin a10 of sdram. 2. the waveform for dackn is when active low is specified. figure 12.30 se lf-refresh timing
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 368 of 982 rej09b0023-0400 relationship between refresh requests and bus cycles: if a refresh request occurs during bus cycle execution, the refresh cycle must wait for the bus cycle to be completed. if a refresh request occurs while the bus is released by the bus arbitration function, the refresh will not be executed until the bus mastership is acquired. if a new refresh request occurs while waiting for the previous refresh request, the previous refresh request is deleted. to refresh co rrectly, a bus cycle long er than the refresh interval or the bus mastership occupation must be prevented from occurring. if a bus mastership is requested during self-refresh, the bus will not be rel eased until the refresh is completed. low-frequency mode: when the slow bit in sdcr is set to 1, output of commands, addresses, and write data, and fetch of read data are perfor med at a timing suitable fo r operating sdram at a low frequency. figure 12.31 shows the access timing in low-frequency mode. in this mode, commands, addresses, and write data are output in synchronization with the falling edge of ckio, which is half a cycle delayed than the normal timing. read data is fetched at the rising edge of ckio, which is half a cycle faster than the normal timing. this timing allows the hold time of commands, addresses, write data, and read data to be extended. if sdram is operated at a high frequency with the slow bit set to 1, the setup time of commands, addresses, write data, and read data are not guaranteed. take the operating frequency and timing design into consideration when making the slow bit setting.
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 369 of 982 rej09b0023-0400 tc1 tr td1 tde tap tr tc1 tnop trwl tap (high) ckio cke a25 to a0 csn rd/wr rasl, rasu dqmxx d31 to d0 bs dackn* 2 a12/a11* 1 casl, casu notes: 1. address pin to be connected to pin a10 of sdram. 2. the waveform for dackn is when active low is specified. figure 12.31 low-freque ncy mode access timing power-down mode: if the pdown bit in the sdcr register is set to 1, the sdram is placed in the power-down mode by bringing the cke signal to the low level in the non-access cycle. this power-down mode can effectively lower the power cons umption in the non-access cycle. however, please note that if an access occurs in the power-down mode, a cycl e of overhead occurs because a cycle is needed to assert the ck e in order to cancel the power-down mode. figure 12.32 shows the access timing in the power-down mode.
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 370 of 982 rej09b0023-0400 tnop power-down tr tc1 td1 tde tap power-down ckio cke a25 to a0 csn rd/wr rasl, rasu dqmxx d31 to d0 bs dackn* 2 a12/a11* 1 casl, casu notes: 1. address pin to be connected to pin a10 of sdram. 2. the waveform for dackn is when active low is specified. figure 12.32 power-down mode access timing the conditions to shift to the power-down mode are as follows. ? write or read access (including instruction fetch) occurs to the memory other than the sdram, which is to be set to the power-down mode. ? read or write access occurs to the control regi ster with the address h'axxx xxxx or to the peripheral i/o register.
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 371 of 982 rej09b0023-0400 power-on sequence: in order to use synchronous dram, mode setting must first be performed after powering on. to perform synchronous dram initialization correctly, the bus state controller registers must first be set, followed by a write to the synchronous dram mode register. in synchronous dram mode register setting, the addr ess signal value at that time is latched by a combination of the csn , rasu , rasl , casu , casl , and rd/ wr signals. if the value to be set is x, the bus state controller provides for value x to be written to the synchronous dram mode register by performing a write to address h'a4fd4000 + x for area 2 synchronous dram, and to address h'a4fd5000 + x for area 3 synchronous dram. in this operation the data is ignored, but the mode write is performed as a byte-size access. to set burst read/single write, cas latency 2 to 3, wrap type = sequential, and burst length 1 supported by the lsi, arbitrary data is written in a byte-size access to the addresses shown in table 12.15. in this time 0 is output at the external address pins of a12 or later. table 12.15 access address in sdram mode register write ? setting for area 2 burst read/single write (burst length 1): data bus width cas latency access address external address pin 16 bits 2 h'a4fd4440 h'0000440 3 h'a4fd4460 h'0000460 32 bits 2 h'a4fd4880 h'0000880 3 h'a4fd48c0 h'00008c0 burst read/burst write (burst length 1): data bus width cas latency access address external address pin 16 bits 2 h'a4fd4040 h'0000040 3 h'a4fd4060 h'0000060 32 bits 2 h'a4fd4080 h'0000080 3 h'a4fd40c0 h'00000c0
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 372 of 982 rej09b0023-0400 ? setting for area 3 burst read/single write (burst length 1): data bus width cas latency access address external address pin 16 bits 2 h'a4fd5440 h'0000440 3 h'a4fd5460 h'0000460 32 bits 2 h'a4fd5880 h'0000880 3 h'a4fd58c0 h'00008c0 burst read/burst write (burst length 1): data bus width cas latency access address external address pin 16 bits 2 h'a4fd5040 h'0000040 3 h'a4fd5060 h'0000060 32 bits 2 h'a4fd5080 h'0000080 3 h'a4fd50c0 h'00000c0 mode register setting timing is shown in figure 12.33. a pall command (all bank pre-charge command) is firstly issued. a ref command (auto refresh command) is then issued 8 times. an mrs command (mode register write command) is finally issued. idle cycles, of which number is specified by the wtrp1 and wtrp0 bits in cs3wcr, are inserted between the pall and the first ref. idle cycles, of which number is sp ecified by the wtrc1 and wtrc0 bits in cs3wcr, are inserted between ref and ref, and between the 8th ref and mrs. idle cycles, of which number is one or more, are in serted between the mrs and a command to be issued next. it is necessary to keep idle time of certain cy cles for sdram before issuing pall command after power-on. refer the manual of the sdram for the idle time to be needed. when the pulse width of the reset signal is longer then the idle time, mode register setting can be started immediately after the reset, but care should be taken when the pulse width of the reset signal is shorter than the idle time.
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 373 of 982 rej09b0023-0400 tpw tp trr trc trc tmw hi-z tnop trc trr trc ref ref mrs pall ckio a25 to a0 csn rd/wr rasl, rasu dqmxx d31 to d0 bs dackn* 2 a12/a11* 1 casl, casu notes: 1. address pin to be connected to pin a10 of sdram. 2. the waveform for dackn is when active low is specified. figure 12.33 synchronous dram mode write timing (based on jedec) low-power sdram: the low-power sdram can be accessed using the same protocol as the normal sdram. the differences between the low-power sdram and no rmal sdram are that partial refresh takes place that puts only a part of the sdram in the self-refresh state during the self-refresh function, and that power consumption is low during refresh under user conditions such as the operating temperatur e. the partial refresh is effective in systems in which there is data in a work area other than the specific area can be lost without severe repercussions. the low-power sdram supports the extension mode register (emrs) in addition to the mode registers as the normal sdram. this lsi supports issuing of the emrs command. the emrs command is issued accor ding to the conditions specified in table 12.21. for example, if data h'0yyyyyyy is written to address h'a4 fd5xx0 in longword, th e commands are issued to the cs3 space in the follo wing sequence: pall -> ref 8 -> mrs -> emrs. in this case, the mrs and emrs issue addresses are h'0000xx0 and h'yyyyyyy, respectively. if data h'1yyyyyyy is written to address h'a4fd5xx0 in longword, the commands are issued to the cs3 space in the following sequence: pall -> mrs -> emrs.
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 374 of 982 rej09b0023-0400 table 12.16 output addresses when emrs command is issued command to be issued access address access data write access size mrs command issue address emrs command issue address cs2 mrs h'a4fd4xx0 h' ******** 16 bits h'0000xx0 ? cs3 mrs h'a4fd5xx0 h' ******** 16 bits h'0000xx0 ? cs2 mrs + emrs (with refresh) h'a4fd4xx0 h'0yyyyyyy 32 bits h'0000xx0 h'yyyyyyy cs3 mrs + emrs (with refresh) h'a4fd5xx0 h'0yyyyyyy 32 bits h'0000xx0 h'yyyyyyy cs2 mrs + emrs (without refresh) h'a4fd4xx0 h'1yyyyyyy 32 bits h'0000xx0 h'yyyyyyy cs3 mrs + emrs (without refresh) h'a4fd5xx0 h'1yyyyyyy 32 bits h'0000xx0 h'yyyyyyy ckio a25 to a0 csn rd/wr rasl, rasu dqmxx d31 to d0 bs tpw dackn* 4 tp trr a12/a11* 3 ba1* 1 ba0* 2 casl, casu notes: 1. address pin to be connected to pin ba1 of sdram. 2. address pin to be connected to pin ba0 of sdram. 3. address pin to be connected to pin a10 of sdram. 4. the waveform for dackn is when active low is specified. trc trc tmw hi-z tnop trc trr trc ref ref mrs temw tnop emrs pall figure 12.34 emrs command issue timing
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 375 of 982 rej09b0023-0400 ? deep power-down mode the low-power sdram supports the deep power-down mode as a low-power consumption mode. in the partial self-refresh function, self-refresh is performed on a specific area. in the deep power-down mode, self-refresh will not be performed on any memory area. this mode is effective in systems where a ll of the system memory area s are used as work areas. if the rmode bit in the sdcr is set to 1 while the deep and rfsh bits in the sdcr are set to 1, the low-power sdram enters the deep power-down mode. if the rmode bit is cleared to 0, the cke signal is pulled high to cancel the deep power-down mode. before executing an access after returning from the deep power-down mode, the power-up sequence must be re-executed. tpw tp tdpd trc hi-z trc trc trc trc ckio cke a25 to a0 csn rd/wr rasl, rasu dqmxx d31 to d0 bs dackn* 2 a12/a11* 1 casl, casu notes: 1. address pin to be connected to pin a10 of sdram. 2. the waveform for dackn is when active low is specified. figure 12.35 deep power-do wn mode transition timing
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 376 of 982 rej09b0023-0400 12.5.7 burst rom (clock asynchronous) interface the burst rom (clock async hronous) interface is used to access a memory with a high-speed read function using a method of address switching called the burst mode or page mode. in a burst rom (clock asynchronous) interface, basically the same access as the normal space is performed, but the 2nd and subsequent accesses are performed only by changing the address, without negating the rd signal at the end of the 1st cycle. in the 2nd and subsequent accesses, addresses are changed at the falling edge of the ckio. for the 1st access cycle, the numb er of wait cycles specified by the w3 to w0 bits in the csnwcr register is inserted. for the 2nd and subs equent access cycles, the number of wait cycles specified by the w1 to w0 bits in the csnwcr register is inserted. in the access to the burst ro m (clock asynchronous), the bs signal is asserted only to the first access cycle. an external wait inpu t is valid only to the first access cycle. in the single access or write access that do not perform the burst oper ation in the page flash rom interface, access timing is same as a normal space. table 12.17 lis ts a relationship between bus width, access size, and the number of bursts. figure 12.36 shows a timing chart. table 12.17 relationship between bus wi dth, access size, an d number of bursts bus width csnwcr. ben bit access size number of bursts number of accesses 8 bits not affected 8 bits 1 1 not affected 16 bits 2 1 not affected 32 bits 4 1 0 16 bytes 16 1 1 4 4 16 bits not affected 8 bits 1 1 not affected 16 bits 1 1 not affected 32 bits 2 1 0 16 bytes 8 1 1 2 4 32 bits not affected 8 bits 1 1 not affected 16 bits 1 1 not affected 32 bits 1 1 not affected 16 bytes 4 1
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 377 of 982 rej09b0023-0400 ckio a25 to a0 rd d15 to d0 dackn* note: * the waveform for dackn when active low is specified. wait csn t1 tw tw tb2 twb tb2 twb tb2 twb t2 rd/wr bs figure 12.36 burst rom access timing (clock asynchronous) (bus width = 32 bits, 16-byte transfer (number of burst 4), wait cycles inserted in first access = 2, wait cycles inserted in second and subsequent accesses = 1) 12.5.8 byte-selection sram interface the byte-selection sram interface is for access to an sram which ha s a byte-selection pin ( wen ). this interface has 16-bit data pins an d accesses srams having upper and lower byte selection pins, such as ub and lb. when the bas bit in the csnwcr register is cl eared to 0 (initial valu e), the write access timing of the byte-selection sram interface is the same as that for the normal space interface. while in read access of a byte-selection sram interface, th e byte-selection signal is output from the wen pin, which is different from that for the normal space interface. the basic access timing is shown in figure 12.37. in write access, data is written to the memory according to the timing of the byte- selection pin ( wen ). for details, please refer to the data sheet for the corresponding memory. if the bas bit in the csnwcr register is set to 1, the wen pin and rd/ wr pin timings change. figure 12.38 shows the basic acce ss timing. in write access, data is written to the memory according to the timing of the write enable pin (rd/ wr ). the data hold timing from rd/ wr negation to data write must be acquired by setting the hw1 and hw0 bits in the csnwcr register. figure 12.39 shows the access timing when a software wait is specified.
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 378 of 982 rej09b0023-0400 ckio a25 to a0 csn wen rd/wr rd rd d31 to d0 d31 to d0 rd/wr bs dackn* read write note: * the waveform for dackn is when active low is specified. t1 t2 high figure 12.37 byte-s election ram basic acce ss timing (bas = 0)
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 379 of 982 rej09b0023-0400 t1 t2 high ckio a25 to a0 csn wen rd/wr rd rd d31 to d0 d31 to d0 rd/wr bs dackn* read write note: * the waveform for dackn is when active low is specified. figure 12.38 byte-s election ram basic acce ss timing (bas = 1)
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 380 of 982 rej09b0023-0400 t2 th th t1 tw high ckio a25 to a0 csn wen rd/wr rd rd d31 to d0 d31 to d0 rd/wr bs dackn* read write note: * the waveform for dackn is when active low is specified. figure 12.39 byte-selection s ram wait timing (bas = 1) (sw[1:0] = 01, wr[3:0] = 0001, hw[1:0] = 01)
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 381 of 982 rej09b0023-0400 a15 a0 cs oe we i/o15 i/o0 ub lb . . . . . . . . . a17 a2 csn rd rd/wr d31 d16 we3 we2 d15 d0 we1 we0 this lsi . . . a15 a0 cs oe we i/o15 i/o0 ub lb . . . . . . . . . 64k 16-bit sram figure 12.40 example of connection with 32-bit data-width byte-selection sram this lsi a16 a1 csn rd rd/wr d15 d0 we1 we0 a15 a0 cs oe we i/o 15 i/o 0 ub lb 64k 16-bit sram figure 12.41 example of connection with 16-bit data-width byte-selection sram
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 382 of 982 rej09b0023-0400 12.5.9 burst mpx-i/o interface figure 12.42 shows an example of a connection between the lsi and an mpx device. figures 12.43 to 12.46 show the burst mpx space access timings. area 6 can be specified as the address/data mu ltiplex i/o (mpx-i/o) inte rface using the type2 to type0 bits in the cs6bcr register. this mpx -i/o interface enables the lsi to be easily connected to an external memory controller chip that uses an address/data multiplexed 32-bit single bus. in this case, the address and the access size for th e mpx-i/o interface are output to d25 to d0 and d31 to d29, resp ectively, in address cycles. for the access sizes of d31 to d29, see the description of the cs6bwcr register (burst mpx-i/o). address pins a25 to a0 are used to output normal addresses. in the burst mpx-i/o interface, the bus size is fixed at 32 bits. the bsz1 and bsz0 bits in cs6bbcr must be specified as 32 bits. in the mpx-i/o interface, a software wait or hardware wait can be inserted using the wait pin. in read cycles, a wait cycle is inserted automa tically following the address output even if the software wait insertion is specified as 0. this lsi cs bs frame we i/o31 i/o0 wait cs6b bs frame rd/wr d31 d0 wait 64k 16-bit sram figure 12.42 burst mpx device connection example
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 383 of 982 rej09b0023-0400 tm1 tmd1w tmd1 a d note: * the waveform for dackn is when active low is specified. ckio d31 to d0 a25 to a0 frame cs6b rd/wr wait bs dackn* figure 12.43 burst mpx space access timing (single read, no wait, or software wait 1)
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 384 of 982 rej09b0023-0400 tm1 tmd1w tmd1w tmd1 ad note: * the waveform for dackn is when active low is specified. ckio d31 to d0 a25 to a0 frame cs6b rd/wr wait bs dackn* figure 12.44 burst mp x space access timing (single write, software wait 1, hardware wait 1)
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 385 of 982 rej09b0023-0400 tm1 tmd1w tmd1 tmd2 tmd3 tmd4 a d0 d1 d2 d3 note: * the waveform for dackn is when active low is specified. ckio d31 to d0 a25 to a0 frame cs6b rd/wr wait bs dackn* figure 12.45 burst mp x space access timing (burst read, no wait, or software wait 1, cs6bwcr.mpxmd = 0)
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 386 of 982 rej09b0023-0400 note: * the waveform for dackn is when active low is specified. ckio d31 to d0 a25 to a0 frame cs6b rd/wr wait bs dackn* tm1 tmd1 tmd2 tmd3 tmd4 a d0 d1 d2 d3 figure 12.46 burst mp x space access timing (burst write, no wait, cs6bwcr.mpxmd = 0) 12.5.10 burst rom interfa ce (clock synchronous) the burst rom (clock synchronou s) interface is supported to access a rom with a synchronous burst function at high speed. the burst rom inte rface accesses the burst rom in the same way as a normal space. this interface is valid only for area 0. in the first access cycle, wait cycl es are inserted. in th is case, the number of wait cycles to be inserted is specified by the w3 to w0 bits in cs0wcr. in the second and subsequent cycles, the number of wait cycles to be inserted is specified by the bw1 and bw0 bits in cs0wcr. while the burst rom is accesse d (clock synchronous), the bs signal is asserted only for the first access cycle and an external wait input is also valid for the first access cycle. if the bus width is 16 bits, the burst length must be specified as 8. if the bus width is 32 bits, the burst length must be specified as 4. the burst rom interface does not support the 8-bit bus width for the burst rom.
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 387 of 982 rej09b0023-0400 the burst rom interface performs burst operations for all read accesses. for example, in a longword access over a 16-b it bus, valid 16-bit data is read two times and invalid 16-bit data is read six times. these invalid data read cycles increase the memory access time and degrade the program execution speed and dma transfer speed. to prevent this problem, it is recommend using a 16-byte read by cache fill or 16-byte re ad by the dmac. thus, the burst rom (clock synchronous) should be accessed with the cache having been set on. the burst rom interface performs write accesses in the same way as normal space access. twb t1 t2 tw t2b tw t2b twb twb t2b t2b twb twb t2b t2b twb t2b twb note: * the waveform for dackn is when active low is specified. ckio d31 to d0 a25 to a0 frame cs6b rd/wr wait bs dackn* figure 12.47 burst rom access timing (clock synchronous) (burst length = 8, wait cycles inserted in first access = 2, wait cycles inserted in seco nd and subsequent accesses = 1) 12.5.11 wait between access cycles as the operating frequency of lsis becomes higher, the off-operation of the data buffer often collides with the next data access when the read operation from devices with slow access speed is completed. as a result of these collisions, the reliability of the device is low and malfunctions may occur. a function that avoids data collisions by inserting wait cycles between continuous access cycles has been newly added. the number of wait cycles between access cycles can be set by bits iww2 to iww0, iwrwd2 to iwrwd0, iwrws2 to iwrws0, iwrrd2 to iwrrd0, and iwrrs2 to iwrrs 0 in the csnbcr register , and bit dmaiw2 to dmaiw0 and dmaiwa in cmncr. the conditions for setting the wait cycles between access cy cles (idle cycles) are shown below. 1. continuous accesses are write-read or write-write 2. continuous accesses are re ad-write for different spaces 3. continuous accesses are re ad-write for the same space 4. continuous accesses are re ad-read for different spaces 5. continuous accesses are read-read for the same space
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 388 of 982 rej09b0023-0400 6. data output from an external device caused by dma single address transfer is followed by data output from another device that includes this lsi (dmaiwa = 0) for details, see the description of the dmaiwa bit in the cmncr register. 7. data output from an external device caused by dma single address transfer is followed by any type of access (dmaiwa = 1) besides the wait cycles between access cycles (idle cycles) described above, idle cycles must be inserted to reserve the minimum pulse width fo r an interface with an internal bus and a multiplexed pin (wen). 8. idle cycle of the external bus fo r the interface with the internal bus a. insert one idle cycle imme diately before a write access cycl e after an external bus idle cycle or a read cycle. b. insert one idle cycle to tran sfer the read data to the internal bus when a read cycle of the external bus terminates. insert two to three idle cycles including the id le cycle in a. for the write cycle immediately after a read cycle. 9. idle cycle of the external bus for accessing different memory for accessing different memory, insert idle cycles as follows. the byte-selection sram interface with the bas bit = 1 specified is ha ndled as an sdram interface because the wen change timing is identical. a. insert one idle cycle to access the interface other than the sdram interface after the write access cycle is performed in the sdram interface. b. insert one idle cycle to acce ss the sdram interface after th e normal space interface with the external wait invalidated or the byte-selection sram in terface with the bas bit = 0 specified is accessed. c. insert one idle cycle to access the sd ram interface after th e mpx-io interface is accessed. d. insert one idle cycle to access the mpx-io interface from the ex ternal bus that is in the idle status. e. insert one idle cycle to acce ss the mpx-io interface after a read cycle is performed in the normal space interface, byte-selection sram in terface with the bas bit = 0 specified or the sdram interface. f. insert two idle cycles to access the mpx-io interface after a wr ite cycle is performed in the sdram interface. g. insert one idle cycle to access the sdra m interface which is not in the low frequency mode after the interface in the sdram lo w frequency mode (sdcr.slow = 1) is accessed.
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 389 of 982 rej09b0023-0400 tables 12.18 to 12.22 lists the minimum number of id le cycles to be insert ed for the normal space interface and the sdram interface. the csnbcr idle setting column in the tables describes the number of idle cycles to be set for iww, iwrwd, iwrws, iwrrd, and iwrrs. table 12.18 minimum number of idle cycles between cpu access cycl es for the normal space interface bsc register setting when access size is less than bus width when access size exceeds bus width csnwcr. wm setting csnbcr idle setting read to read write to write read to write write to read contin- uous read * 1 contin- uous write * 1 read to read * 2 write to write * 2 read to write * 2 write to read * 2 1 0 1/1/1/2 1/1/2/3 3/ 3/4/5 0/0/0/0 0/0/0/0 0/0/0/0 1/ 1/1/2 0/0/0/1 3/ 3/4/5 0/0/0/0 0 0 1/1/1/2 1/1/2/3 3/ 3/4/5 1/1/1/1 1/1/1/1 1/1/1/1 1/ 1/1/2 1/1/1/1 3/ 3/4/5 1/1/1/1 1 1 1/1/1/2 1/1/2/3 3/ 3/4/5 1/1/1/1 1/1/1/1 1/1/1/1 1/ 1/1/2 1/1/1/1 3/ 3/4/5 1/1/1/1 0 1 1/1/1/2 1/1/2/3 3/ 3/4/5 1/1/1/1 1/1/1/1 1/1/1/1 1/ 1/1/2 1/1/1/1 3/ 3/4/5 1/1/1/1 1 2 2/2/2/2 2/2/2/3 3/ 3/4/5 2/2/2/2 2/2/2/2 2/2/2/2 2/ 2/2/2 2/2/2/2 3/ 3/4/5 2/2/2/2 0 2 2/2/2/2 2/2/2/3 3/ 3/4/5 2/2/2/2 2/2/2/2 2/2/2/2 2/ 2/2/2 2/2/2/2 3/ 3/4/5 2/2/2/2 1 4 4/4/4/4 4/4/4/4 4/ 4/4/5 4/4/4/4 4/4/4/4 4/4/4/4 4/ 4/4/4 4/4/4/4 4/ 4/4/5 4/4/4/4 0 4 4/4/4/4 4/4/4/4 4/ 4/4/5 4/4/4/4 4/4/4/4 4/4/4/4 4/ 4/4/4 4/4/4/4 4/ 4/4/5 4/4/4/4 1 6 6/6/6/6 6/6/6/6 6/ 6/6/6 6/6/6/6 6/6/6/6 6/6/6/6 6/ 6/6/6 6/6/6/6 6/ 6/6/6 6/6/6/6 0 6 6/6/6/6 6/6/6/6 6/ 6/6/6 6/6/6/6 6/6/6/6 6/6/6/6 6/ 6/6/6 6/6/6/6 6/ 6/6/6 6/6/6/6 0, 1 n (n>=8) n/n/n/n n/ n/n/n n/n/n/n n/n/n/n n/n/n/n n/n/n/ n n/n/n/n n/n/n/n n/n/n/n n/n/n/n notes: the minimum number of idle cycles is described sequentially for i : b (4:1/3:1/2 :1/1:1). 1. minimum number of idle cycles between the upper and lower 16-bit access cycles in the 32-bit access cycle when the bus width is 16 bits, and the minimum number of idle cycles between continuous access cycles during 16-byte transfer 2. minimum number of idle cycles for other than the above cases
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 390 of 982 rej09b0023-0400 table 12.19 minimum number of idle cycles between access cycles during dmac dual address mode transfer for the normal space interface bsc register setting when access size is less than bus width when access size exceeds bus width csnwcr. wm setting csnbcr idle setting read to write write to read continuous read * 1 read to write * 2 continuous write * 1 write to read * 2 1 0 2 0 0 2 0 0 0 0 2 1 1 2 1 1 1 1 2 1 1 2 1 1 0 1 2 1 1 2 1 1 1 2 2 2 2 2 2 2 0 2 2 2 2 2 2 2 1 4 4 4 4 4 4 4 0 4 4 4 4 4 4 4 0, 1 n (n 6) n n n n n n notes: dmac is operated by b . the minimum number of idle cycles is not affected by changing a clock ratio. 1. minimum number of idle cycles between the upper and lower 16-bit access cycles in the 32-bit access cycle when the bus width is 16 bits, and the minimum number of idle cycles between continuous access cycles during 16-byte transfer 2. minimum number of idle cycles for other than the above cases.
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 391 of 982 rej09b0023-0400 table 12.20 minimum number of idle cycles during dmac single address mode transfer to the normal space interface from the external device with dack (1) transfer from the external device with dack to the normal space interface bsc register setting * 3 when access size is less than bus width csnwcr.wm setting cmncr.dmaiwa setting cmncr.dmaiw idle setting continuous transfer* 1 non-continuous transfer* 2 1 0 ? 0 2 0 0 ? 1 2 1 1 0 0 2 0 1 0 1 2 1 1 1 1 2 0 1 1 1 2 1 1 2 2 2 0 1 2 2 2 1 1 4 4 4 0 1 4 4 4 0, 1 1 n (n 6) n n
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 392 of 982 rej09b0023-0400 (2) transfer from the normal space in terface to the external device with dack bsc register setting * 4 when access size is less than bus width csnwcr.wm setting csnbcr idle setting continuous transfer* 1 non-continuous transfer* 2 1 0 0 3 0 0 1 3 1 1 1 3 0 1 1 3 1 2 2 3 0 2 2 3 1 4 4 4 0 4 4 4 0, 1 n (n 6) n n notes: dmac is operated by b . the minimum number of idle cycles is not affected by changing a clock ratio. 1. minimum number of idle cycles between the upper and lower 16-bit access cycles in the 32-bit access cycle when the bus width is 16 bits, and the minimum number of idle cycles between continuous access cycles during 16-byte transfer 2. other than the above cases. 3. for single transfer from the external device with dack to the normal space interface, the minimum number of idle cycles is not affected by the iww, iwrwd, iwrws, iwrrd, and iwrrs bits in csnbcr. 4. for single transfer from the normal spac e interface to the external device with dack , the minimum number of idle cycles is not affected by the dmaiwa and dmaiw bits in cmncr.
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 393 of 982 rej09b0023-0400 table 12.21 minimum number of idle cycles between access cycles of cpu and the dmac dual address mode fo r the sdram interface bsc register setting cpu access dmac access csnbcr idle setting cs3wcr. wtrp setting cs3wcr. trwl setting read to read write to write read to write write to read read to write write to read 0 0 0 1/1/1/2 1/1/2/3 3/3/4/ 5 0/0/0/0 2 0 0 0 1 1/1/1/2 1/1/2/3 3/3/4/ 5 1/1/1/1 2 1 0 0 2 1/1/1/2 2/2/2/3 3/3/4/ 5 2/2/2/2 2 2 0 0 3 1/1/1/2 3/3/3/3 3/3/4/ 5 3/3/3/3 2 3 0 1 0 2/2/2/2 1/1/2/3 3/3/4/ 5 1/1/1/1 2 1 0 1 1 2/2/2/2 2/2/2/3 3/3/4/ 5 2/2/2/2 2 2 0 1 2 2/2/2/2 3/3/3/3 3/3/4/ 5 3/3/3/3 2 3 0 1 3 2/2/2/2 4/4/4/4 3/3/4/ 5 4/4/4/4 2 4 0 2 0 3/3/3/3 2/2/2/3 3/3/4/ 5 2/2/2/2 3 2 0 2 1 3/3/3/3 3/3/3/3 3/3/4/ 5 3/3/3/3 3 3 0 2 2 3/3/3/3 4/4/4/4 3/3/4/ 5 4/4/4/4 3 4 0 2 3 3/3/3/3 5/5/5/5 3/3/4/ 5 5/5/5/5 3 5 0 3 0 4/4/4/4 3/3/3/3 4/4/4/ 5 3/3/3/3 4 3 0 3 1 4/4/4/4 4/4/4/4 4/4/4/ 5 4/4/4/4 4 4 0 3 2 4/4/4/4 5/5/5/5 4/4/4/ 5 5/5/5/5 4 5 0 3 3 4/4/4/4 6/6/6/6 4/4/4/ 5 6/6/6/6 4 6 1 0 0 2/2/2/2 1/1/2/3 3/3/4/ 5 1/1/1/1 2 1 1 0 1 2/2/2/2 1/1/2/3 3/3/4/ 5 1/1/1/1 2 1 1 0 2 2/2/2/2 2/2/2/3 3/3/4/ 5 2/2/2/2 2 2 1 0 3 2/2/2/2 3/3/3/3 3/3/4/ 5 3/3/3/3 2 3 1 1 0 2/2/2/2 1/1/2/3 3/3/4/ 5 1/1/1/1 2 1 1 1 1 2/2/2/2 2/2/2/3 3/3/4/ 5 2/2/2/2 2 2 1 1 2 2/2/2/2 3/3/3/3 3/3/4/ 5 3/3/3/3 2 3 1 1 3 2/2/2/2 4/4/4/4 3/3/4/ 5 4/4/4/4 2 4 1 2 0 3/3/3/3 2/2/2/3 3/3/4/ 5 2/2/2/2 3 2 1 2 1 3/3/3/3 3/3/3/3 3/3/4/ 5 3/3/3/3 3 3 1 2 2 3/3/3/3 4/4/4/4 3/3/4/ 5 4/4/4/4 3 4
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 394 of 982 rej09b0023-0400 bsc register setting cpu access dmac access csnbcr idle setting cs3wcr. wtrp setting cs3wcr. trwl setting read to read write to write read to write write to read read to write write to read 1 2 3 3/3/3/3 5/5/5/5 3/3/4/ 5 5/5/5/5 3 5 1 3 0 4/4/4/4 3/3/3/3 4/4/4/ 5 3/3/3/3 4 3 1 3 1 4/4/4/4 4/4/4/4 4/4/4/ 5 4/4/4/4 4 4 1 3 2 4/4/4/4 5/5/5/5 4/4/4/ 5 5/5/5/5 4 5 1 3 3 4/4/4/4 6/6/6/6 4/4/4/ 5 6/6/6/6 4 6 2 0 0 3/3/3/3 2/2/2/3 3/3/4/ 5 2/2/2/2 3 2 2 0 1 3/3/3/3 2/2/2/3 3/3/4/ 5 2/2/2/2 3 2 2 0 2 3/3/3/3 2/2/2/3 3/3/4/ 5 2/2/2/2 3 2 2 0 3 3/3/3/3 3/3/3/3 3/3/4/ 5 3/3/3/3 3 3 2 1 0 3/3/3/3 2/2/2/2 3/3/4/ 5 2/2/2/2 3 2 2 1 1 3/3/3/3 2/2/2/2 3/3/4/ 5 2/2/2/2 3 2 2 1 2 3/3/3/3 3/3/3/3 3/3/4/ 5 3/3/3/3 3 3 2 1 3 3/3/3/3 4/4/4/4 3/3/4/ 5 4/4/4/4 3 4 2 2 0 3/3/3/3 2/2/2/3 3/3/4/ 5 2/2/2/2 3 2 2 2 1 3/3/3/3 3/3/3/3 3/3/4/ 5 3/3/3/3 3 3 2 2 2 3/3/3/3 4/4/4/4 3/3/4/ 5 4/4/4/4 3 4 2 2 3 3/3/3/3 5/5/5/5 3/3/4/ 5 5/5/5/5 3 5 2 3 0 4/4/4/4 3/3/3/3 4/4/4/ 5 3/3/3/3 4 3 2 3 1 4/4/4/4 4/4/4/4 4/4/4/ 5 4/4/4/4 4 4 2 3 2 4/4/4/4 5/5/5/5 4/4/4/ 5 5/5/5/5 4 5 2 3 3 4/4/4/4 6/6/6/6 4/4/4/ 5 6/6/6/6 4 6 4 0 0 5/5/5/5 4/4/4/4 5/5/5/ 5 4/4/4/4 5 4 4 0 1 5/5/5/5 4/4/4/4 5/5/5/ 5 4/4/4/4 5 4 4 0 2 5/5/5/5 4/4/4/4 5/5/5/ 5 4/4/4/4 5 4 4 0 3 5/5/5/5 4/4/4/4 5/5/5/ 5 4/4/4/4 5 4 4 1 0 5/5/5/5 4/4/4/4 5/5/5/ 5 4/4/4/4 5 4 4 1 1 5/5/5/5 4/4/4/4 5/5/5/ 5 4/4/4/4 5 4 4 1 2 5/5/5/5 4/4/4/4 5/5/5/ 5 4/4/4/4 5 4 4 1 3 5/5/5/5 4/4/4/4 5/5/5/ 5 4/4/4/4 5 4
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 395 of 982 rej09b0023-0400 bsc register setting cpu access dmac access csnbcr idle setting cs3wcr. wtrp setting cs3wcr. trwl setting read to read write to write read to write write to read read to write write to read 4 2 0 5/5/5/5 4/4/4/4 5/5/5/ 5 4/4/4/4 5 4 4 2 1 5/5/5/5 4/4/4/4 5/5/5/ 5 4/4/4/4 5 4 4 2 2 5/5/5/5 4/4/4/4 5/5/5/ 5 4/4/4/4 5 4 4 2 3 5/5/5/5 5/5/5/5 5/5/5/ 5 5/5/5/5 5 5 4 3 0 5/5/5/5 4/4/4/4 5/5/5/ 5 4/4/4/4 5 4 4 3 1 5/5/5/5 4/4/4/4 5/5/5/ 5 4/4/4/4 5 4 4 3 2 5/5/5/5 5/5/5/5 5/5/5/ 5 5/5/5/5 5 5 4 3 3 5/5/5/5 6/6/6/6 5/5/5/ 5 6/6/6/6 5 6 n (n>=6) ? ? all n+1 n/n/n/n a ll n+1 n/n/n/n n+1 n notes: the minimum number of idle cycles in cpu access is described sequentially for i :b (4:1/3:1/2:1/1:1). 1. dmac is operated by b . the minimum number of idle cycles is not affected by changing a clock ratio.
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 396 of 982 rej09b0023-0400 table 12.22 minimum number of idle cycles between access cycles of the dmac single address mode for the sdram interface (1) transfer from the external device with dack to the sdram interface bsc register setting * 2 cmncr.dmaiw setting cs3wcr.wtrp setting cs3wcr.trwl setting minimum number of idle cycles 0 0 0 3 0 0 1 3 0 0 2 3 0 0 3 3 0 1 0 3 0 1 1 3 0 1 2 3 0 1 3 4 0 2 0 3 0 2 1 3 0 2 2 4 0 2 3 5 0 3 0 3 0 3 1 4 0 3 2 5 0 3 3 6 1 0 0 3 1 0 1 3 1 0 2 3 1 0 3 3 1 1 0 3 1 1 1 3 1 1 2 3 1 1 3 4 1 2 0 3 1 2 1 3 1 2 2 4 1 2 3 5 1 3 0 3 1 3 1 4
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 397 of 982 rej09b0023-0400 bsc register setting * 2 cmncr.dmaiw setting cs3wcr.wtrp setting cs3wcr.trwl setting minimum number of idle cycles 1 3 2 5 1 3 3 6 2 0 1 3 2 0 2 3 2 0 3 3 2 1 0 3 2 1 1 3 2 1 2 3 2 1 3 4 2 2 0 3 2 2 1 3 2 2 2 4 2 2 3 5 2 3 0 3 2 3 1 4 2 3 2 5 2 3 3 6 4 0 0 4 4 0 1 4 4 0 2 4 4 0 3 4 4 1 0 4 4 1 1 4 4 1 2 4 4 1 3 4 4 2 0 4 4 2 1 4 4 2 2 4 4 2 3 5 4 3 0 4 4 3 1 4 4 3 2 5 4 3 3 6 n (n>=6) ? ? n
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 398 of 982 rej09b0023-0400 (2) transfer from the sdram inte rface to the external device with dack bsc register setting * 2 cs3bcr idle setting cs3wcr.wtrp setting minimum number of idle cycles 0 0 3 0 1 3 0 2 3 0 3 4 1 0 3 1 1 3 1 2 3 1 3 4 2 0 3 2 1 3 2 2 3 2 3 4 4 0 5 4 1 5 4 2 5 4 3 5 n (n>=6) ? n+1 notes: dmac is operated by b . the minimum number of idle cycles is not affected by changing a clock ratio. 1. for single transfer from the external device with dack to the sdram interface, the minimum number of idle cycles is not a ffected by the iww, iw rwd, iwrws, iwrrd, and iwrrs bits in csnbcr. for cmncr.dmiwa = 0, the setting is ident ical to cmncr.dmaiw[1:0] in (1) in the above table. 2. minimum number of idle cycles for other than the above cases.
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 399 of 982 rej09b0023-0400 12.5.12 bus arbitration the bus arbitration of this lsi has the bus master ship in the normal state and releases the bus mastership after receiving a bu s request from another device. bus mastership is transf erred at the boundary of bus cycles. namely, bus mastership is released immediately after receiving a bus request when a bus cycle is not being performed. the release of bus mastership is delayed until the bus cycle is complete when a bus cycle is in progress. even when from outside the lsi it looks like a bus cycle is not being performed, a bus cycle may be performing internally, started by inserting wait cycles between acces s cycles. therefore, it cannot be immediately determined whether or not bus mastership has been released by looking at the csn signal or other bus control signals. the states th at do not allow bus mast ership release are shown below. 1. 16-byte transfer because of a cache miss 2. during write-back operation for the cache 3. between the read and write cycles of a tas instruction 4. multiple bus cycles generated when the data bus width is smaller than the access size (for example, between bus cycles when longword acces s is made to a memory with a data bus width of 8 bits) 5. 16-byte transfer by the dmac 6. setting the block bit in the cmncr register to 1 the lsi has the bus mastership until a bus request is received from another device. upon acknowledging the assertion (low level) of the external bus request signal breq , the lsi releases the bus at the completion of the current bus cycle and asserts the back signal. after the lsi acknowledges the negation (high level) of the breq signal that indicates the external device has released the bus, it negates the back signal and resumes the bus usage. the sdram interface issues all bank pre-charge commands (palls) when active banks exist and releases the bus after comp letion of a pall command. the bus sequence is as follows. th e address bus and data bus are pl aced in a high-impedance state synchronized with the rising edge of ckio. th e bus mastership enable signal is asserted 0.5 cycles after the above timing, sy nchronized with the falling edge of ckio. the bus control signals ( bs , csn , rasu , rasl , casu , casl , cke, dqmxx, wen , rd , and rd/ wr ) are placed in the high-impedance state at subse quent rising edges of ckio. bus request signals are sampled at the falling edge of ckio. even when the bus is released, signals cke, rasu , rasl , casu , and casl can be driven with previous values according to the setting of the hizcnt bit in cmncr.
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 400 of 982 rej09b0023-0400 the sequence for reclaiming the bus mastership from an external device is described below. 1.5 cycles after the negation of breq is detected at the falling edge of ckio, the bus control signals are driven high. the bus enable signal is negated at the next falling edge of the clock. the fastest timing at which actual bus cycles can be resumed afte r bus control signal assertion is at the rising edge of the ckio where address and data signals are driven. figure 12.48 shows the bus arbitration timing. while releasing the bus mastership, the sleep inst ruction (to enter the sleep mode or the standby mode), as well as a manual reset, cannot be execu ted until the lsi obtains the bus mastership. the breq input signal is ignored in the standby mode and the back output signal are placed in the high impedance state. if the bus mastership request is required in this st ate, the bus mastership must be released by pulling down the back pin to enter the standby mode. the bus mastership release ( breq signal for high level negation) after the bus mastership request ( breq signal for low level assertion) must be performed after the bus usage permission ( back signal for low level assertion). if the breq signal is negated before the back signal is asserted, only one cycle of the back signal is asserted depending on the timing of the breq signal to be negated and this may cause a bus contention between the external device and the lsi. ckio other bus contorol sigals breq back a25 to a0 d31 to d0 csn figure 12.48 bus arbitration timing (clock mode 7 or cmncr.hizcnt = 1)
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 401 of 982 rej09b0023-0400 12.5.13 others reset: the bus state controller (bsc) can be initialized completely only at power-on reset. when a power-on reset occurs, internal clocks are synchr onized by the reset, then all signals are negated and output buffers are turned off regardless of the bus cycle state. all control registers are initialized. in standby, sleep, and manual reset, control regist ers of the bus state contro ller are not initialized. at manual reset, the current bus cycle being ex ecuted is completed and then the access wait state is entered. if a 16-byte transfer is performed by a cache or if another lsi on-chip bus master module is executed when a manual reset occurs, the current access is cancelled in longword units because the access request is cancelled by the bus master at manual reset. if a manual reset is requested during cache fill operations, the contents of the c ache cannot be guaranteed. since the rtcnt continues counting up during manual reset si gnal assertion, a refresh request occurs to initiate the refresh cycle. however, a bus arbitration request by the breq signal cannot be accepted during manual reset signal assertion. some flash memories ma y specify a minimum time from rese t release to the first access. to ensure this minimum time, the bus state controll er supports a 7-bit counter (rwtcnt). at power- on reset, the rwtcnt is cleared to 0. after power-on reset, rwtcnt is counted up synchronously together w ith ckio and an external access will not be generated until rwtcnt is counted up to h'007f. at manual reset, rwtcnt is not cleared. access from the site of th e lsi internal bus master: there are three types of lsi internal buses: a cache bus, internal bus, and peripheral bus. the cpu and cache memory are connected to the cache bus. internal bu s masters other than the cpu and bus state controller are connected to the internal bus. low-speed peri pheral modules are connected to the peripheral bus. internal memories other than the cache memory are connected bidirectionally to the cache bus and internal bus. access from the cache bus to the internal bus is enabled but access from the internal bus to the cache bus is disabled. this give s rise to the following problems. on-chip bus masters such as dm ac other than the cpu can access internal memory other than the cache memory but cannot access the cache memory. if an on-chip bus master other than the cpu writes data to an external memory other than the cache, the contents of the external memory may differ from that of the cach e memory. to prevent this problem, if the external memory whose contents is cached is written by an on-chip bus master other than the cpu, the corresponding cache memory should be purged by software.
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 402 of 982 rej09b0023-0400 if the cpu initiates read access for the cache, the cac he is searched. if th e cache stores data, the cpu latches the data and completes the read access. if the cache does not store data, the cpu performs four contiguous longword read cycles to perform cache fill operations via the internal bus. if a cache miss occurs in byte or word operan d access or at a branch to an odd word boundary (4n + 2), the cpu performs four contiguous longword accesses to perform a cache fill operation on the external interface. for a cache-through area, the cpu performs access according to the actual access addresses. for an instruction fetch to an even word boundary (4n), the cpu performs longword access. for an instruc tion fetch to an odd word bound ary (4n + 2), the cpu performs word access. for a read cycle of a non-cache ar ea or an on-chip peripheral mo dule, the read cycle is first accepted and then read cycle is initiated. the read data is sent to the cpu via the cache bus. in a write cycle for the cache area, the write cy cle operation differs accord ing to the cache write methods. in write-back mode, the cache is first searched. if data is detected at the address corresponding to the cache, the data is then re-wr itten to the cache. in the actual memory, data will not be re-written until data in the corresponding address is re-wri tten. if data is not detected at the address corresponding to the cache, the cache is modified. in this case, data to be modified is first saved to the internal buffer, 16-byte data including the data corresponding to the address is then read, and data in the corresponding access of the cache is finally modified. following these operations, a write-back cycle for the save d 16-byte data is executed. in write-through mode, the cache is first searched . if data is detected at the address corresponding to the cache, the data is re-written to the cache si multaneously with the actua l write via the internal bus. if data is not detected at the address corres ponding to the cache, the cache is not modified but an actual write is performed via the internal bus. since the bus state controller (b sc) incorporates a one-stage writ e buffer, the bsc can execute an access via the internal bus before the previous exte rnal bus cycle is comple ted in a write cycle. if the on-chip module is read or written after the ex ternal low-speed memory is written, the on-chip module can be accessed before the completion of th e external low-speed me mory write cycle. in read cycles, the cpu is placed in the wait state until read operation has been completed. to continue the process after the data write to the device has been completed, perform a dummy read to the same address to check for completion of the write before the next process to be executed. the write buffer of the bsc func tions in the same way for an acces s by a bus master other than the cpu such as the dmac. accord ingly, to perform dual address dma transfers, the next read cycle is initiated before the previous write cycle is completed. note, however, that if both the
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 403 of 982 rej09b0023-0400 dma source and destination addresses exist in ex ternal memory space, the next write cycle will not be initiated until the previous write cycle is completed. if bsc registers are modified while the write buffer is functioning, correct access cannot be performed. thus, do not modify bsc registers immediately after the writing has finished. if bsc registers need to be modified, modify the registers after dummy reading the write data. on-chip periphera l module access: to access an on-chip modul e register, two or more peripheral module clock (p ) cycles are required. care must be taken in system design.
section 12 bus state controller (bsc) rev. 4.00 sep. 14, 2005 page 404 of 982 rej09b0023-0400
section 13 direct memory access controller (dmac) rev. 4.00 sep. 14, 2005 page 405 of 982 rej09b0023-0400 section 13 direct memory access controller (dmac) this lsi includes the direct memory access controller (dmac). the dmac can be used in place of the cpu to perform high-speed transfers between external devices that have dack (transfer request acknowledge signal), external memory, on-chip memory, memory-mapped external devi ces, and on-chip peripheral modules. figure 13.1 shows a block diagram of the dmac. 13.1 features ? four channels (two channels can receive an external request) ? 4-gbyte physical address space ? data transfer unit is selectable: byte, word (two bytes), longword (four bytes), and 16 bytes (longword 4) ? maximum transfer count: 16,777,216 transfers (24 bits) ? address mode: dual address mode and single address mode are supported. ? transfer requests ? external request ? on-chip peripheral module request ? auto request the following modules can issue an on-chip peripheral module request. ? scif0, scif1, scif2, mtu0, mtu1, mt u2, mtu3, mtu4, usb, cmt0, cmt1, a/d converter 0, a/d converter 1 ? selectable bus modes ? cycle steal mode (normal mode and intermittent mode) ? burst mode ? selectable channel priority levels: the channel priority levels are selectable between fixed mode and round-robin mode. ? interrupt request: an interrupt request can be generated to the cpu at the end of the specified counts of data transfer. ? external request detection: there are following four types of dreq input detection. ? low level detection ? high level detection ? rising edge level detection ? falling edge level detection
section 13 direct memory access controller (dmac) rev. 4.00 sep. 14, 2005 page 406 of 982 rej09b0023-0400 ? transfer request acknowledge and transf er end signals: active levels for dack and tend can be set independently. figure 13.1 shows the block diagram of the dmac. on-chip peripheral module dma transfer request signal dma transfer acknowledge signal peripheral bus internal bus external rom x/y memory interrupt controller dreq0 , dreq1 dein dack0, dack1 tend external ram bus interface bus state controller external device (memory mapped) external device (with acknowledge- ment) request priority control start-up control register control iteration control sar_n dar_n dmatcr_n chcr_n dmaor dmars0,1 [legend] sar_n: dar_n: dmatcr_n: chcr_n: dmaor: dmars0,1: dein: n: dma source address register dma destination address register dma transfer count register dma channel control register dma operation register dma extension resource selector dma transfer end interrupt request to the cpu 0, 1, 2, 3 dmac module figure 13.1 block diagram of the dmac
section 13 direct memory access controller (dmac) rev. 4.00 sep. 14, 2005 page 407 of 982 rej09b0023-0400 13.2 input/output pins the external pins for dmac are described below. table 13.1 lists the configuration of the pins that are connected to external bus. dmac has pins for 2 channels (channels 0 and 1) for external bus use. table 13.1 pin configuration channel name sy mbol i/o function dma transfer request dreq0 i dma transfer request input from external device to channel 0 dma transfer request acknowledge dack0 o strobe output to an external i/o at dma transfer request from external device to channel 0 0 dma transfer end tend o dma transfer end output for channel 0 dma transfer request dreq1 i dma transfer request input from external device to channel 1 1 dma transfer request acknowledge dack1 o strobe output to an external i/o at dma transfer request from external device to channel 1
section 13 direct memory access controller (dmac) rev. 4.00 sep. 14, 2005 page 408 of 982 rej09b0023-0400 13.3 register descriptions register configuration is described below. see section 24, list of registers, for the addresses of these registers and the state of them in each processing status. channel 0: ? dma source address register_0 (sar_0) ? dma destination address register_0 (dar_0) ? dma transfer count re gister_0 (dmatcr_0) ? dma channel control register_0 (chcr_0) channel 1: ? dma source address register_1 (sar_1) ? dma destination address register_1 (dar_1) ? dma transfer count re gister_1 (dmatcr_1) ? dma channel control register _1 (chcr_1) channel 2: ? dma source address register_2 (sar_2) ? dma destination address register_2 (dar_2) ? dma transfer count re gister_2 (dmatcr_2) ? dma channel control register_2 (chcr_2) channel 3: ? dma source address register_3 (sar_3) ? dma destination address register_3 (dar_3) ? dma transfer count re gister_3 (dmatcr_3) ? dma channel control register_3 (chcr_3) common: ? dma operation register (dmaor) ? dma extension resource selector 0 (dmars0) ? dma extension resource selector 1 (dmars1)
section 13 direct memory access controller (dmac) rev. 4.00 sep. 14, 2005 page 409 of 982 rej09b0023-0400 13.3.1 dma source addr ess registers (sar) dma source address registers (sar) are 32-bit read/write registers that specify the source address of a dma transfer. during a dma transfer, these registers indi cate the next source address. when the data of an external device with dack is transferred in the singl e address mode, the sar is ignored. to transfer data in 16 bits or in 32 bits, specify the address with 16-bit or 32-bit address boundary. when transferring data in 16-byte units, a 16-byte boundary (address 16n) must be set for the source address value. the sar is undefined at reset and retains the current value in standby or module standby mode. 13.3.2 dma destination address registers (dar) dma destination address registers (dar) are 32 -bit read/write registers that specify the destination address of a dma tran sfer. these registers include c ount functions, and during a dma transfer, these registers indicate the next destination address. when the data of an external device with dack is transferred in the single address mode, the dar is ignored. to transfer data in 16 bits or in 32 bits, specify the address with 16-bit or 32-bit address boundary. when transferring data in 16-byte units, a 16-byte boundary (address 16n) must be set for the source address value. the dar is undefined at reset and retains the current value in standby or module standby mode. 13.3.3 dma transfer count registers (dmatcr) dma transfer count registers (d matcr) are 32-bit read/write re gisters that specify the dma transfer count (bytes, words, or longwords). the number of tran sfers is 1 when the setting is h'000001, 16777215 when h'00ffffff is set, and 16777216 (the maximum) when h'000000 is set. during a dma transfer, these register s indicate the remaining transfer count. the upper eight bits of dmatcr will return 0 if read, and should only be written with 0. to transfer data in 16 bytes, one 16-byte transfer (128 bits) counts one. the dmatcr is undefined at reset and retains the current value in standby or module standby mode.
section 13 direct memory access controller (dmac) rev. 4.00 sep. 14, 2005 page 410 of 982 rej09b0023-0400 13.3.4 dma channel control registers (chcr) dma channel control registers (chcr) are 32-b it read/write registers that control the dma transfer mode. the chcr is initialized to h'00000000 at reset and retains the current value in the standby or module standby mode. bit bit name initial value r/w descriptions 31 tc 0 r/w transfer count mode this bit selects whether it transmits once by one transfer request or transmits the number of setting times of dmatcr by one transfer request. this bit is effective only when transfer request original is mtu0 to mtu4, and cmt0 and cmt1 at an on-chip peripheral module request. other than this, please specify 0 to be this bit then. 0: it transmits once by one transfer request. 1: it transmits the number of setting times of dmatcr by one transfer request. 30 to 24 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 23 do 0 r/w dma overrun this bit selects whether dreq is detected by overrun 0 or by overrun 1. this bit is valid only in chcr_0 and chcr_1.this bit is always read as 0 in chcr_1 and chcr_3. the write value should always be 0. 0: detects dreq by overrun 0 1: detects dreq by overrun 1 22 tl 0 r/w transfer end level this bit specifies the tend signal output is high active or low active. this bit is valid only in chcr_0.this bit is always read as 0 in chcr_1 and chcr_3. the write value should always be 0. 0: low-active output of tend 1: high-active output of tend
section 13 direct memory access controller (dmac) rev. 4.00 sep. 14, 2005 page 411 of 982 rej09b0023-0400 bit bit name initial value r/w descriptions 21 to 18 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 17 am 0 r/w acknowledge mode am specifies whether dack is output in data read cycle or in data write cycle in dual address mode. in single address mode, dack is always output regardless of the specification by this bit. this bit is valid only in chcr_0 and chcr_1.this bit is always read as 0 in chcr_2 and chcr_3. the write value should always be 0. 0: dack output in read cycle (dual address mode) 1: dack output in write cycle (dual address mode) 16 al 0 r/w acknowledge level al specifies the dack (acknowledge) signal output is high active or low active. this bit is valid only in chcr_0 and chcr_1.this bit is always read as 0 in chcr_2 and chcr_3. the write value should always be 0. 0: low-active output of dack 1: high-active output of dack 15 14 dm1 dm0 0 0 r/w r/w destination address mode dm1 and dm0 select whet her the dma destination address is incremented, decremented, or left fixed. (in single address mode, dm1 and dm0 bits are ignored when data is transferred to an external device with dack .) 00: fixed destination address (setting prohibited in 16- byte transfer) 01: destination address is incremented (+1 in 8-bit transfer, +2 in 16-bit transfe r, +4 in 32-bit transfer, +16 in 16-byte transfer) 10: destination address is decremented (?1 in 8-bit transfer, ?2 in 16-bit transfer, ?4 in 32-bit transfer; illegal setting in 16-byte transfer) 11: reserved (setting prohibited)
section 13 direct memory access controller (dmac) rev. 4.00 sep. 14, 2005 page 412 of 982 rej09b0023-0400 bit bit name initial value r/w descriptions 13 12 sm1 sm0 0 0 r/w r/w source address mode sm1 and sm0 select whether the dma source address is incremented, decremented, or left fixed. (in single address mode, sm1 and sm0 bits are ignored when data is transferred from an external device with dack .) 00: fixed source address (setting prohibited in 16-byte transfer) 01: source address is incremented (+1 in 8-bit transfer, +2 in 16-bit transfer, +4 in 32-bit transfer, +16 in 16-byte transfer) 10: source address is decremented (?1 in 8-bit transfer, ?2 in 16-bit transfer, ?4 in 32-bit transfer; illegal setting in 16-byte transfer) 11: reserved (setting prohibited) resource select rs3 to rs0 specify which transfer requests will be sent to the dmac. the changing of transfer request source should be done in the state that dma enable bit (de) is set to 0. 0 0 0 0 external request, dual address mode 0 0 0 1 reserved (setting prohibited) 0 0 1 0 external request/single address mode external address space external device with dack 0 0 1 1 external request/single address mode external device with dack external address space 0 1 0 0 auto request 0 1 0 1 reserved (setting prohibited) 0 1 1 0 reserved (setting prohibited) 0 1 1 1 reserved (setting prohibited) 1 0 0 0 dma expansion request modu le selection specification 1 0 0 1 reserved (setting prohibited) 1 0 1 0 reserved (setting prohibited) 1 0 1 1 reserved (setting prohibited) 1 1 0 0 reserved (setting prohibited) 1 1 0 1 reserved (setting prohibited) 1 1 1 0 a/d converter 0 11 10 9 8 rs3 rs2 rs1 rs0 0 0 0 0 r/w r/w r/w r/w 1 1 1 1 cmt0 note: external request specification is valid only in chcr_0 and chcr_1. none of the request sources can be selected in channels chcr_2 and chcr_3.
section 13 direct memory access controller (dmac) rev. 4.00 sep. 14, 2005 page 413 of 982 rej09b0023-0400 bit bit name initial value r/w descriptions 7 6 dl ds 0 0 r/w r/w dreq level and dreq edge select these bits specify the sampling method of the dreq pin input and the sampling level. these bits are valid only in chcr_0 and chcr_1. these bits are always read as 0 in chcr_2 and chcr_3. the write value should always be 0. in channels 0 and 1, also, if the transfer request source is specified as an on-chip peripheral module or if an auto-request is specified, the s pecification by this bit is ignored. 00: dreq detected in low level 01: dreq detected at falling edge 10: dreq detected in high level 11: dreq detected at rising edge 5 tb 0 r/w transfer bus mode this bit specifies the bus mode when dma transfers data. 0: cycle steal mode (initial value) 1: burst mode set this bit to 0 when the on-chip peripheral module is requesting dma transfer, the setting for the transfer count mode bit is 0, and the source of the transfer request is the mtu. 4 3 ts1 ts0 0 0 r/w r/w transmit size ts1 and ts0 specify the size of data to be transferred. select the size of data to be transferred when the source or destination is an on-chip peripheral module register of which transfer size is specified. 00: byte size 01: word size (two bytes) 10: longword size (four bytes) 11: 16-byte unit (four longword transfers)
section 13 direct memory access controller (dmac) rev. 4.00 sep. 14, 2005 page 414 of 982 rej09b0023-0400 bit bit name initial value r/w descriptions 2 ie 0 r/w interrupt enable this bit specifies whether or not an interrupt request is generated to the cpu at the end of the dma transfer. setting this bit to 1 generates an interrupt request (dei) to the cpu when te bit is set to 1. 0: interrupt request is not generated 1: interrupt request is generated 1 te 0 r/w * transfer end flag this bit shows that dma transfer ends. te is set to 1 when data transfer ends when dmatcr becomes to 0. the te bit is not set to 1 in the following cases. ? dma transfer ends due to a nmi interrupt or dma address error before dmatcr becomes to 0. ? dma transfer is ended by clearing the de bit and dme bit in dma operation register (dmaor). even if the de bit is set to 1 while this bit is set to 1, transfer is not enabled. 0: during the dma transfer or dma transfer has been interrupted 1: data transfer ends by the specified count (dmactr = 0) [clearing condition] writing 0 after te = 1 read
section 13 direct memory access controller (dmac) rev. 4.00 sep. 14, 2005 page 415 of 982 rej09b0023-0400 bit bit name initial value r/w descriptions 0 de 0 r/w dma enable this bit enabler or disables the dma transfer. in an auto request mode, dma transfer starts by setting the de bit and dme bit in dmaor to 1. in this time, all of the bits te, nmif in dmaor, and ae must be 0's. in an external request or peripheral module request, dma transfer starts if dma transfer request is generated by the devices or peripheral modules after setting the bits de and dme to 1. in this case, however, all of the bits te, nmif, and ae must be 0's an in the case of auto request mode. clearing the de bit to 0 can terminate the dma transfer. 0: dma transfer disabled 1: dma transfer enabled note: * writing 0 is possible to clear the flag.
section 13 direct memory access controller (dmac) rev. 4.00 sep. 14, 2005 page 416 of 982 rej09b0023-0400 13.3.5 dma operation register (dmaor) the dma operation register (dmaor) is a 32-bit re ad/write register that specifies the priority level of channels at the dma tr ansfer. this register shows the dma transfer status. the dmaor is initialized to h'00000000 at reset and retains the current value in the standby or module standby mode. bit bit name initial value r/w description 31, 30 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 29 28 cms1 cms0 0 0 r/w r/w cycle steal mode select 1, 0 these bits select either normal mode or intermittent mode in cycle steal mode. it is necessary that the bus modes of all channels be set to cycle steal mode to make the intermittent mode valid. 00: normal mode 01: reserved (setting prohibited) 10: intermittent mode 16 executes one dma transfer in each of 16 clocks of an external bus clock. 11: intermittent mode 64 executes one dma transfer in each of 64 clocks of an external bus clock. 27, 26 ? all 0 r reserved these bits are always read as 0. the write value should always be 0.
section 13 direct memory access controller (dmac) rev. 4.00 sep. 14, 2005 page 417 of 982 rej09b0023-0400 bit bit name initial value r/w description 25 24 pr1 pr0 0 0 r/w r/w priority mode 1, 0 pr1 and pr0 select the priority level between channels when there are transfer requests for multiple channels simultaneously. 00: fixed mode 1: ch0 > ch1 > ch2 > ch3 01: fixed mode 2: ch0 > ch2 > ch3 > ch1 10: the status of the channel select round-robin mode: rcn bit is reflected to the priority. 11: all channel round-robin mode 23 to 19 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 18 ae 0 r/(w) * address error flag ae indicates that an address error occurred during dma transfer. if this bit is set during data transfer, transfers on all channels are suspended. the cpu cannot write 1 to this bit. this bit can only be cleared by writing 0 after reading 1. 0: no dmac address error 1: dmac address error [clear condition] writing ae = 0 after ae = 1 read 17 nmif 0 r/(w) * nmi flag nmif indicates that a nmi in terrupt occurred. this bit is set regardless of whether dmac is in operating or halt state. the cpu cannot write 1 to this bit. only 0 can be written to clear this bit after 1 is read. when the nmi is input, the dma transfer in progress can be done in one transfer unit. when the dmac is not in operational, the nmif bit is set to 1 even if the nmi interrupt was input. 0: no nmi input 1: nmi interrupt occurs [clearing condition] writing nmif = 0 after nmif = 1 read
section 13 direct memory access controller (dmac) rev. 4.00 sep. 14, 2005 page 418 of 982 rej09b0023-0400 bit bit name initial value r/w description 16 dme 0 r/w dma master enable dme enables or disables dma transfers on all channels. if the dme bit and the de bit corresponding to each channel in chcr are set to 1s, transfer is enabled in the corresponding channel. if this bit is cleared during transfer, transfers in all the channels can be terminated. even if the dme bit is set, transfer is not enabled if the te bit is 1 or the de bit is 0 in chcr, or the nmif bit is 1 in dmaor. 0: disable dma transfers on all channels 1: enable dma transfers on all channels 15 to 6 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 5 4 3 2 rc0 rc1 rc2 rc3 0 0 0 0 r/w r/w r/w r/w round robin cannel select rc3, rc2, rc1, and rc0 select the priority level between channels when there are transfer requests for multiple channels simultaneously. 0: the priority level of the chn (n: 0 to 3) is fixed. when all rc bits is 0, the priority level is: ch0 > ch1 > ch2 > ch3, equals with fixed mode (mdoe7). 1: the priority level of the chn (n: 0 to 3) is determined by the round-robin. when all rc bits are 1, the priority level between channels equals with round- robin mode (mode 5). 1, 0 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. note: * writing 0 is possible to clear the flag. if dma transfers are requested to multiple channels simultaneously, the dmac performs transfers according to the specified channel priority. the ch annel priority is determined by the round-robin select bits (rc0, rc1, rc2, rc3) and priority mode bits (pr1 and pr0) of the dmaor register.
section 13 direct memory access controller (dmac) rev. 4.00 sep. 14, 2005 page 419 of 982 rej09b0023-0400 if (pr1 and pr0) = (b'10) is specified, the channel priority is determined according to the settings of the round-robin select bits. in this case, the channel priority is changed between channels whose corresponding round-robin select bit is set to 1. if (pr1 and pr0) = (b'01) is specified, the channel priority is specified as fixed mode 2 (ch0 > ch2 > ch3 > ch1). if (pr1 and pr0) = (b'11) is specified, the channel priority is specified as the all-channel round-robin mode. if (pr1 and pr0) = (b'00) is specified, the channel priori ty is specified as fixed mode 1 (ch0 > ch1 > ch2 > ch3). note that the round-robin select bit values are ignored except when (pr1 and pr0) = (b'10) is specified. if the round-robin select bit or the priority mode bit is modified after a dma transfer, the channel priority is initialized to be changed. if fixed mode 2 is specified, the channel priority is specified as ch0 > ch2 > ch3 > ch1. if fixed mode 1 is specified, the channel prio rity is specified as ch0 > ch1 > ch2 > ch3. if a mode including round-robin mode is specified again, the transfer end channel is reset. table 13.2 summarizes the relationship among the round-robin select bits, priority bits, channel priority, and priority modes (mode 0 to mode 7). each priority mode includes up to five kinds of channel priority according to the transfer end channel. for example, if the round-robin se lect bits are specified as (rc0 to rc3) = (b'1110) to select mode 3 and if the transfer end channel is channel 1, the priority of the channel to accept the next transfer request is specified as ch0 > ch1 > ch 2 >ch3. when the channel on which the transfer was just finished is ch3, ch3 is not intended for round-robin. therefore the priority level is not changed.
section 13 direct memory access controller (dmac) rev. 4.00 sep. 14, 2005 page 420 of 982 rej09b0023-0400 table 13.2 combination of the round-robi n select bits and priority mode bits priority level round-robin select bit transfer end priority bit high low mode no. rc0 rc1 rc2 rc3 ch no. pr1 pr0 0 1 2 3 0 0 0 1 1 ch2 1 0 ch0 ch1 ch3 ch2 0 1 1 1 ch1 1 0 ch0 ch2 ch3 ch1 1 0 1 1 1 ch2 1 0 ch0 ch3 ch1 ch2 2 1 1 0 0 ch0 1 0 ch1 ch0 ch2 ch3 1 1 1 0 ch0 1 0 ch1 ch2 ch0 ch3 3 1 1 1 0 ch1 1 0 ch2 ch0 ch1 ch3 1 1 1 1 ch0 1 0 ch1 ch2 ch3 ch0 1 1 1 1 ch1 1 0 ch2 ch3 ch0 ch1 4 1 1 1 1 ch2 1 0 ch3 ch0 ch1 ch2 ? other than the above setting prohibited ? 1 0 ? ? ? ? * * * * ch0 1 1 ch1 ch2 ch3 ch0 * * * * ch1 1 1 ch2 ch3 ch0 ch1 5 (all-channel round-robin) * * * * ch2 1 1 ch3 ch0 ch1 ch2 6 (fixed mode 2) * * * * * 0 1 ch0 ch2 ch3 ch1 7 (fixed mode 1) * * * * * 0 0 ch0 ch1 ch2 ch3 note: * any
section 13 direct memory access controller (dmac) rev. 4.00 sep. 14, 2005 page 421 of 982 rej09b0023-0400 13.3.6 dma extension resource selector 0 and 1 (dmars0, dmars1) dmars is a 16-bit read/write register that speci fies the dma transfer sources from peripheral modules in each channel. dmars0 specifies fo r channels 0 and 1, dmars1 specifies for channels 2 and 3. this register can set the transfer request of scif0, scif1, scif2, mtu0, mtu1, mtu2, mtu3, mtu4, mtu, usb, a/d converter 1, and cmt1. this register is initialized to h'0000 by power-on manual reset. the previous value is held in standby mode or module standby mode. ? dmars0 bit bit name initial value r/w description 15 14 13 12 11 10 c1mid5 c1mid4 c1mid3 c1mid2 c1mid1 c1mid0 0 0 0 0 0 0 r/w r/w r/w r/w r/w r/w transfer request module id5 for dma channel 1 (mid). see table 13.3. 9 8 c1rid1 c1rid0 0 0 r/w r/w transfer request register id for dma channel 1 (rid). see table 13.3. 7 6 5 4 3 2 c0mid5 c0mid4 c0mid3 c0mid2 c0mid1 c0mid0 0 0 0 0 0 0 r/w r/w r/w r/w r/w r/w transfer request module id for dma channel 0 (mid). see table 13.3 1 0 c0rid1 c0rid0 0 0 r/w r/w transfer request register id for dma channel 0 (rid). see table 13.3.
section 13 direct memory access controller (dmac) rev. 4.00 sep. 14, 2005 page 422 of 982 rej09b0023-0400 ? dmars1 bit bit name initial value r/w description 15 14 13 12 11 10 c3mid5 c3mid4 c3mid3 c3mid2 c3mid1 c3mid0 0 0 0 0 0 0 r/w r/w r/w r/w r/w r/w transfer request module id for dma channel 3 (mid). see table 13.3. 9 8 c3rid1 c3rid0 0 0 r/w r/w transfer request module id for dma channel 3 (rid). see table 13.3. 7 6 5 4 3 2 c2mid5 c2mid4 c2mid3 c2mid2 c2mid1 c2mid0 0 0 0 0 0 0 r/w r/w r/w r/w r/w r/w transfer request module id for dma channel 2 (mid). see table 13.3. 1 0 c2rid1 c2rid0 0 0 r/w r/w transfer request module id for dma channel 2 (rid). see table 13.3.
section 13 direct memory access controller (dmac) rev. 4.00 sep. 14, 2005 page 423 of 982 rej09b0023-0400 transfer requests from the vari ous modules are specified by the mid and rid as shown in table 13.3. table 13.3 transfer request module/register id peripheral module setting value for one channel (mid + rid) mid rid function scif0 h'88 b'100010 b'00 transmit h'89 b'01 receive scif1 h'90 b'100100 b'00 transmit h'91 b'01 receive scif2 h'40 b'010000 b'00 transmit h'41 b'01 receive mtu0 h'a8 b'101010 b'00 tgi0a mtu1 h'c0 b'110000 b'00 tgi1a mtu2 h'c8 b'110010 b'00 tgi2a mtu3 h'd0 b'110100 b'00 tgi3a mtu4 h'e8 b'111010 b'00 tgi4a usb h'a0 b'101000 b'00 transmit h'a1 b'01 receive a/d converter 1 h'b0 b'101100 b'00 ? cmt1 h'f0 b'111100 b'00 ? when mid/rid other than the values listed in table 13.3 is set, the operation of this lsi is not guaranteed. the transfer request fr om the dmars register is valid only when the resource select bits (rs3 to rs0) have been set to b'1000 for ch cr0 to chcr3 registers. otherwise, even if the dmars has been set, transfer request source is not accepted.
section 13 direct memory access controller (dmac) rev. 4.00 sep. 14, 2005 page 424 of 982 rej09b0023-0400 13.4 operation when there is a dma transfer request, the dmac starts the transfer according to the predetermined channel priority order; when the tr ansfer end conditions are satisfied, it ends the transfer. transfer s can be requested in three modes: auto request, external request, and on-chip module request. the dual address mode has direct address transfer mode and indirect address transfer mode. in the bus mode, the burst mode or the cy cle steal mode can be selected. 13.4.1 dma transfer flow after the dma source address registers (sar), dma destination address registers (dar), dma transfer count registers (dmatcr), dma channel control registers (chcr), dma operation register (dmaor), and dma extension resource se lector (dmars) are set, the dmac transfers data according to the following procedure: 1. checks to see if transfer is enabled (de = 1, dme = 1, te = 0, ae = 0, nmif = 0) 2. when a transfer request comes and transfer is enabled, the dmac transfers 1 transfer unit of data (depending on the ts0 and ts1 settings). for an auto request, the transfer begins automatically when the de bit and dme bit are set to 1. the dmatcr value will be decrement for each transf er. the actual transfer flows vary by address mode and bus mode. 3. when the specified number of transfer ha ve been completed (when dmatcr reaches 0), the transfer ends normally. if the ie bit of the chcr is set to 1 at this time, a dei interrupt is sent to the cpu. 4. when a nmi interrupt is generated, the transfer is aborted. transfers are also aborted when the de bit of the chcr or the dme bit of the dmaor are changed to 0.
section 13 direct memory access controller (dmac) rev. 4.00 sep. 14, 2005 page 425 of 982 rej09b0023-0400 figure 13.2 is a flowchart of this procedure. normal end nmif = 1 or ae = 1 or de = 0 or dme = 0? bus mode, transfer request mode, dreq detection selection system initial settings (sar, dar, dmatcr, chcr, dmaor, dmars) transfer (1 transfer unit); dmatcr ? 1 dmatcr, sar and dar updated dei interrupt request (when ie = 1) te = 1 no yes no yes no yes yes no yes no * 3 * 2 start transfer aborted dmatcr = 0? transfer request occurs?* 1 de, dme = 1 and nmif, ae, te = 0? nmif = 1 or ae = 1 or de = 0 or dme = 0? transfer end notes: 1. in auto-request mode, transfer begins when nmif and te are all 0 and the de and dme bits are set to 1. 2. dreq = level detection in burst mode (external request) or cycle-steal mode. 3. dreq = edge detection in burst mode (external request), or auto-request mode in burst mode. figure 13.2 dma transfer flowchart
section 13 direct memory access controller (dmac) rev. 4.00 sep. 14, 2005 page 426 of 982 rej09b0023-0400 13.4.2 dma transfer requests dma transfer requests are basically generated in e ither the data transfer so urce or destination, but they can also be generated by devices and on-chip peripheral modules that are neither the source nor the destination. transfers can be requested in three modes: auto request, external request, and on-chip module request. the request mode is selected in the rs3 to rs0 bits of the dma channel control registers 0 to 3 (chcr_0 to chcr_3), and the dma extension resource selectors 0 and 1 (dmars0, dmars1). auto-request mode: when there is no transfer request sign al from an external source, as in a memory-to-memory transfer or a transfer between memory and an on-chip peripheral module unable to request a transfer, the auto-request mode allows the dmac to automatically generate a transfer request signal internally. when the de bits of chcr_0 to chcr_3 and the dme bit of the dmaor are set to 1, the transfer begins so long as the te bits of chcr_0 to chcr_3 and the nmif bit of dmaor are all 0. external request mode: in this mode a transfer is performed at the request signals ( dreq0 to dreq1 ) of an external device. this is valid for dma channels 0 to 1. choose one of the modes shown in table 13.4 according to the application system. when this mode is selected, if the dma transfer is enabled (de = 1, dme = 1, te = 0, ae = 0, nmif = 0), a transfer is performed upon a request at the dreq input. table 13.4 selecting external re quest modes with the rs bits rs3 rs2 rs1 rs0 address mode source destination 0 0 0 0 dual address mode any any 0 external memory, memory-mapped external device external device with dack 0 0 1 1 single address mode external device with dack external memory, memory-mapped external device choose to detect dreq by either the falling edge or low level of the signal input with the dreq level (dl) bit and ds bit of chcr_0 and chcr_1 as shown in table 13.5. the source of the transfer request does not have to be the data transfer source or destination.
section 13 direct memory access controller (dmac) rev. 4.00 sep. 14, 2005 page 427 of 982 rej09b0023-0400 table 13.5 selecting external request detection with dl, ds bits chcr dl ds detection of external request 0 low level detection 0 1 falling edge detection 0 high level detection 1 1 rising edge detection when dreq is accepted, the dreq pin becomes request accept di sabled state (non-sensitive period). after issuing acknowledge signal dack for the accepted dreq , the dreq pin again becomes request accept enabled state. when dreq is used by level detection, there are fo llowing two cases by the timing to detect the next dreq after outputting dack . overrun0: transfer is aborted after the same number of transfer has been performed as requests. overrun1: transfer is aborted after transfers have been performed for (the number of requests plus 1) times. the do bit in chcr selects this overrun 0 or overrun 1. table 13.6 selecting external request detection with do bit chcr_0 or chcr_1 do external request 0 overrun 0 1 overrun 1
section 13 direct memory access controller (dmac) rev. 4.00 sep. 14, 2005 page 428 of 982 rej09b0023-0400 on-chip peripheral module request: in this mode, the transfer is performed in response to the dma transfer request signal of an on-chip periph eral module. signals that request dma transfer include a/d conversion-completed transfer re quests from a/d converter 0, compare-match transfer requests from the cmt0 timer, transmit-data empty transfer requests and receive-data full transfer requests from the scif0 to scif2 that are set by dmars0 and 1, compare-match and input-capture interrupts from the mtu0 to mtu4 timers, transmit-data-e mpty transfer requests and receive-data-full tran sfer requests from the usb module, a/d conversion-completed transfer requests from a/d converter 1, and compare-match transfer requests from the cmt1 timer. when the transfer request is a transmit-data-empty transfer request, set the transfer destination as the corresponding scif transmit-data register. like wise, when the transfer request is a receive- data full transfer request, se t the transfer destination as th e corresponding scif receive-data register. requests from the usb are handled in an analogous way. if a transfer is requested from the a/d converter 0 and a/d converter 1, the tr ansfer source must be the a/d data register (addr). any address can be specified for data source and destinatio n, when transfer request is generated by cmt0, cmt1, and mtu0 to mtu4. table 13.7 selecting on-chip peripheral module request modes with the rs3 to rs0 bits chcr dmars rs[3:0] mid rid dma transfer request source dma transfer request signal source destination bus mode 1110 any any a/d converter 0 adi (a/d conversion end interrupt) addr any cycle steal 1111 any any cmt0 compare-match transfer request any any burst/ cycle steal 1000 100010 00 scif0 transmitter txi (transmit data fifo empty interrupt) any scftdr0 cycle steal 01 scif0 receiver rxi (receive data fifo full interrupt) scfrdr0 any cycle steal 100100 00 scif1 transmitter txi (transmit data fifo empty interrupt) any scftdr1 cycle steal 01 scif1 receiver rxi (receive data fifo full interrupt) scfrdr1 any cycle steal 010000 00 scif2 transmitter txi (transmit data fifo empty interrupt) any scftdr2 cycle steal 01 scif2 receiver rxi (receive data fifo full interrupt) scfrdr2 any cycle steal
section 13 direct memory access controller (dmac) rev. 4.00 sep. 14, 2005 page 429 of 982 rej09b0023-0400 chcr dmars rs[3:0] mid rid dma transfer request source dma transfer request signal source desti- nation bus mode 1000 101010 00 mtu0 tgi0a (input capture interrupt/ compare match interrupt) any any burst/ cycle steal 110000 00 mtu1 tgi1a (input capture interrupt/ compare match interrupt) any any burst/ cycle steal 110010 00 mtu2 tgi2a (input capture interrupt/ compare match interrupt) any any burst/ cycle steal 110100 00 mtu3 tgi3a (input capture interrupt/ compare match interrupt) any any burst/ cycle steal 111010 00 mtu4 tgi4a (input capture interrupt/ compare match interrupt) any any burst/ cycle steal 101000 00 usb transmitter ep2fifo empty transfer request any usbepdr2 cycle steal 01 usb receiver ep1fifo full transfer request usbepdr1 any cycle steal 101100 00 a/d converter 1 adi (a/d conversion end interrupt) addr1 any cycle steal 111100 00 cmt1 compare-match transfer request any any burst/ cycle steal 13.4.3 channel priority when the dmac receives simultaneous transfer re quests on two or more channels, it selects a channel according to a predetermined priority order. the four modes (fixed mode 1, fixed mode 2, channel selective round-robin mo de, and all-channel round-robin mode) are selected using the priority bits pr0, pr1, and rc0 to rc3 in the dma operation register (dmaor). fixed mode: in these modes, the priority levels amon g the channels remain fixed. there are two kinds of fixed modes as follows: fixed mode 1: ch0 > ch1 > ch2 > ch3 fixed mode 2: ch0 > ch2 > ch3 > ch1
section 13 direct memory access controller (dmac) rev. 4.00 sep. 14, 2005 page 430 of 982 rej09b0023-0400 these are selected by the pr1 and the pr0 b its in the dma operation register (dmaor). round-robin mode: each time one word, byte, or longword is transferred on one channel, the priority order is rotated. the channel on which the transfer was just finished rotates to the bottom of the priority order. the round-robin mode operation is shown in figure 13.3. the priority of the round-robin mode is ch0 > ch1 > ch2 > ch3 immediately after reset. when the round-robin mode has been specified, do not concurrently specify cycle steal mode and burst mode as the bus modes of any two channels. ch1 > ch2 > ch3 > ch0 ch0 > ch1 > ch2 > ch3 ch2 > ch3 > ch0 > ch1 ch0 > ch1 > ch2 > ch3 ch2 > ch3 > ch0 > ch1 ch0 > ch1 > ch2 > ch3 ch0 > ch1 > ch2 > ch3 ch3 > ch0 > ch1 > ch2 ch0 > ch1 > ch2 > ch3 (1) when channel 0 transfers initial priority order initial priority order initial priority order priority order afrer transfer priority order afrer transfer priority order does not change channel 2 becomes bottom priority. the priority of channels 0 and 1, which were higher than channel 2, are also shifted. if immediately after there is a request to transfer channel 1 only, channel 1 becomes bottom priority and the priority of channels 0 and 3, which were higher than channel 1, are also shifted. channel 1 becomes bottom priority. the priority of channel 0, which was higher than channel 1, is also shifted. channel 0 becomes bottom priority priority order afrer transfer priority order afrer transfer priority order afrer transfer post-transfer priority order when there is an immediate transfer request to channel 5 only (2) when channel 1 transfers (3) when channel 2 transfers (4) when channel 3 transfers figure 13.3 round-robin mode
section 13 direct memory access controller (dmac) rev. 4.00 sep. 14, 2005 page 431 of 982 rej09b0023-0400 figure 13.4 shows how the priority order changes when channel 0 and channel 3 transfers are requested simultaneously and a channel 1 transfer is requested during the channel 0 transfer. the dmac operates as follows: 1. transfer requests are generated simultaneously to channels 0 and 3. 2. channel 0 has a higher priority, so the channel 0 transfer begins first (channel 3 waits for transfer). 3. a channel 1 transfer request occurs during the channel 0 transfer (channels 1 and 3 are both waiting) 4. when the channel 0 transfer ends, channel 0 becomes lowest priority. 5. at this point, channel 1 has a higher priority than channel 3, so the channel 1 transfer begins (channel 3 waits for transfer). 6. when the channel 1 transfer ends, channel 1 becomes lowest priority. 7. the channel 3 transfer begins. 8. when the channel 3 transfer ends, channels 3 and 2 shift downward in priority so that channel 3 becomes the lowest priority. transfer request waiting channel (s) dmac operation channel priority (1) channels 0 and 3 (3) channel 1 0 > 1 > 2 > 3 (2) channel 0 transfer start (4) channel 0 transfer ends (5) channel 1 transfer starts (6) channel 1 transfer ends (7) channel 3 transfer starts (8) channel 3 transfer ends 1 > 2 > 3 > 0 2 > 3 > 0 > 1 0 > 1 > 2 > 3 priority order changes priority order changes priority order changes none 3 3 1, 3 figure 13.4 changes in channe l priority in round-robin mode
section 13 direct memory access controller (dmac) rev. 4.00 sep. 14, 2005 page 432 of 982 rej09b0023-0400 13.4.4 dma transfer types dma transfer has two types; single address mode transfer and dual address mode transfer. they depend on the number of bus cycl es of access to source and dest ination. a data transfer timing depends on the bus mode, which has cycle steal mode and burst mode. the dmac supports the transfers shown in table 13.8. table 13.8 supported dma transfers destination source external device with dack external memory memory-mapped external device on-chip peripheral module x/y memory u memory external device with dack not available dual, single dual, si ngle not available not available external memory dual, singl e dual dual dual dual memory-mapped external device dual, single dual dual dual dual on-chip peripheral module not available dual dual dual dual x/y memory, u memory not available dual dual dual dual notes: 1. dual: dual address mode 2. single: single address mode 3. 16-byte transfer is not available for on-chip peripheral modules.
section 13 direct memory access controller (dmac) rev. 4.00 sep. 14, 2005 page 433 of 982 rej09b0023-0400 address modes: 1. dual address mode in the dual address mode, both the transfer source and destina tion are accessed (selected) by an address. the source and des tination can be located externally or internally. dma transfer requires two bus cycl es because data is read from the transfer source in a data read cycle and written to the tran sfer destination in a data write cycle. at this time, transfer data is temporarily stored in the dmac. in th e transfer between extern al memories as shown in figure 13.5, data is read to the dmac from one external memo ry in a data read cycle, and then that data is written to the other external memory in a write cycle. data buffer address bus data bus address bus data bus memory transfer source module transfer destination module memory transfer source module transfer destination module sar dar data buffer sar dar the sar value is an address, data is read from the transfer source module, and the data is tempolarily stored in the dmac. first bus cycle second bus cycle the dar value is an address and the value stored in the data buffer in the dmac is written to the transfer destination module. dmac dmac figure 13.5 data flow of dual address mode auto request, external request, and on-chip pe ripheral module request are available for the transfer request. dack can be ou tput in read cycle or write cycle in dual address mode. the am bit of the channel control regist er (chcr) can specify whether the dack is output in read cycle or write cycle.
section 13 direct memory access controller (dmac) rev. 4.00 sep. 14, 2005 page 434 of 982 rej09b0023-0400 figure 13.6 shows an example of dma transfer timing in dual address mode. ckio a25 to a0 note: in transfer between external memories, with dack output in the read cycle, dack output timing is the same as that of csn. d31 to d0 wen rd dackn (active-low) csn transfer source address transfer destination address data read cycle data write cycle (1st cycle) (2nd cycle) figure 13.6 example of dma tr ansfer timing in dual mode (source: ordinary memory, dest ination: ordinary memory) 2. single address mode in single address mode, either the transfer source or transfer destination peripheral device is accessed (selected) by means of the dack signal, and the other device is accessed by address. in this mode, the dmac performs one dma tran sfer in one bus cycle, accessing one of the external devices by outputting the dack transfer request acknowledge signal to it, and at the same time outputting an address to the other device involved in the transfer. for example, in the case of transfer between external memory and an external device with dack shown in figure 13.7, when the external device outputs data to the data bus, that data is written to the external memory in the same bus cycle.
section 13 direct memory access controller (dmac) rev. 4.00 sep. 14, 2005 page 435 of 982 rej09b0023-0400 dmac this lsi dack dreq external address bus external data bus external memory external device with dack data flow figure 13.7 data flow in single address mode two kinds of transfer are possib le in single address mode: (1) transfer between an external device with dack and a memory-mapped external device, and (2) transfer between an external device with dack and external memory. in both cases, only the external request signal ( dreq ) is used for transfer requests.
section 13 direct memory access controller (dmac) rev. 4.00 sep. 14, 2005 page 436 of 982 rej09b0023-0400 figure 13.8 shows example of dma tr ansfer timing in si ngle address mode. address output to external memory space select signal to external memory space select signal to external memory space data output from external device with dack dack signal (active-low) to external device with dac k write strobe signal to external memory space address output to external memory space data output from external memory space dack signal (active-low) to external device with dac k read strobe signal to external memory space (a) external device with dack external memory space (ordinary memory) (b) external memory space (ordinary memory) external device with dack ck a25 to a0 d31 to d0 dackn csn we ck a25 to a0 d31 to d0 dackn csn rd figure 13.8 example of dma transf er timing in single address mode bus modes: there are two bus modes: cycle steal and burst. select the mode in the tb bits of the channel control register (chcr). 1. cycle-steal mode ? normal mode in the normal mode of cycle-st eal, the bus mastership is given to another bus master after a one-transfer-unit (byte, word, longword, or 16 bytes unit) dma transfer. when another transfer request occurs , the bus masterships are obtained from the other bus master and a transfer is performed fo r one transfer unit. when that transfer en ds, the bus mastership is passed to the other bus master. this is repeated until the transfer end conditions are satisfied. in the cycle-steal mode, transfer areas are not affected regardless of se ttings of the transfer request source, transf er source, and transfer destination.
section 13 direct memory access controller (dmac) rev. 4.00 sep. 14, 2005 page 437 of 982 rej09b0023-0400 figure 13.9 shows an example of dma transf er timing in the cycle steal mode. transfer conditions shown in the figure are: 1. dual address mode 2. dreq low level detection cpu cpu cpu dmac dmac cpu dmac dmac cpu dreq bus cycle bus mastership returned to cpu once read/write read/write figure 13.9 dma transfer example in the cycle-steal normal mode (dual address, dreq low level detection) ? intermittent mode 16 and intermittent mode 64 in the intermittent mode of cycle steal, dmac re turns the bus mastership to other bus master whenever a unit of transfer (byte, word, longword, or 16 bytes) is complete. if the next transfer request occurs after that, dmac gets the bus mastership from other bus master after waiting for 16 or 64 clocks in b count. dmac then transfers data of one unit and returns the bus mastership to other bus master. these operations are repeated until the tr ansfer end condition is satisfied. it is thus possible to make lower th e ratio of bus occupation by dma transfer than the normal mode of cycle steal. when dmac gets again the bus mastership, dma transfer can be postpon ed in case of entry updating due to cache miss. this intermittent mode can be used for all tran sfer section; transfer requester, source, and destination. the bus modes, however, must be cycle steal mode in all channels. figure 13.10 shows an example of dma transfer timing in cycle steal intermittent mode. transfer conditions shown in the figure are: 1. dual address mode 2. dreq low level detection
section 13 direct memory access controller (dmac) rev. 4.00 sep. 14, 2005 page 438 of 982 rej09b0023-0400 dreq cpu cpu bus cycle cpu dmac dmac cpu cpu dmac dmac cpu read/write read/write more than 16 or 64b (change by the cpu's condition of using bus) figure 13.10 example of dma transfer in cycle steal in termittent mode (dual address, dreq low level detection) 2. burst mode once the bus mastership is obtained, the transfer is performed continuously until the transfer end condition is satisfied. in the external re quest mode with low level detection of the dreq pin, however, when the dreq pin is driven high, the bus passes to the other bus master after the dmac transfer request that has already be en accepted ends, even if the transfer end conditions have not been satisfied. the burst mode cannot be used for other than cmt0, cmt1, and mtu0 to mtu4 when the on-chip peripheral module is the transfer request source. figure 13.11 shows dma transfer timing in the burst mode. cpu cpu cpu dmac dmac dmac dmac dmac dmac cpu dreq bus cycle read read read write write write figure 13.11 dma transfer example in the burst mode (dual address, dreq low level detection) relationship between request modes and bus modes by dma transfer category: table 13.9 shows the relationship between request modes and bus modes by dma transfer category.
section 13 direct memory access controller (dmac) rev. 4.00 sep. 14, 2005 page 439 of 982 rej09b0023-0400 table 13.9 relationship of request mode s and bus modes by dma transfer category address mode transfer category request mode bus mode transfer size (bits) usable channels external device with dack and external memory external b/c 8/16/32/128 0, 1 external device with dack and memory-mapped external device external b/c 8/16/32/128 0, 1 external memory and external memory all * 1 b/c 8/16/32/128 0 to 3 * 5 external memory and memory-mapped external device all * 1 b/c 8/16/32/128 0 to 3 * 5 memory-mapped external device and memory- mapped external device all * 1 b/c 8/16/32/128 0 to 3 * 5 external memory and on-chip peripheral module all * 2 b/c * 3 8/16/32/128 * 4 0 to 3 * 5 memory-mapped external device and on-chip peripheral module all * 2 b/c * 3 8/16/32/128 * 4 0 to 3 * 5 on-chip peripheral module and on-chip peripheral module all * 2 b/c * 3 8/16/32/128 * 4 0 to 3 * 5 x/y memory, u memory and x/y memory, u memory all * 1 b/c 8/16/32/128 0 to 3 * 5 x/y memory, u memory and memory-mapped external device all * 1 b/c 8/16/32/128 0 to 3 * 5 x/y memory, u memory and on-chip peripheral module all * 2 b/c * 3 8/16/32/128 * 4 0 to 3 * 5 dual x/y memory, u memory and external memory all * 1 b/c 8/16/32/128 0 to 3 * 5 external device with dack and external memory external b/c 8/16/32/128 0, 1 single external device with dack and memory-mapped external device external b/c 8/16/32/128 0, 1 [legend] b: burst c: cycle steal notes: 1. external requests, auto requests, and on-chip peripheral module requests are all available. in the case of on-chip peripheral module requests, however, cmt0, cmt1, and mtu0 to mtu4 are only available. 2. external requests, auto requests, and on-chip peripheral module requests are all available. however, for on-chip peripheral module requests, the module must be designated as the transfer request source or the transfer destination except cmt0, cmt1, and mtu0 to mtu4. 3. for on-chip peripheral module requests, t he transfer source is in cycle steal mode except cmt0, cmt1, and mtu0 to mtu4. 4. access size permitted for the on-chip perip heral module register functioning as the transfer source or transfer destination. 5. if the transfer request is an external request, channels 0 to 1 are only available.
section 13 direct memory access controller (dmac) rev. 4.00 sep. 14, 2005 page 440 of 982 rej09b0023-0400 bus mode and channel priority order: when channel 1 is transferring data in burst mode and a request arrives for transfer on channel 0, which has higher-priority, the data transfer on channel 0 will begin immediately. in this case, if the transfer on channel 0 is also in burst mode, the transfer on channel 1 will only resume on comple tion of the transfer on channel 0. when channel 0 is in cycle steal mode, one transfer-unit of the data on this channel, which has the higher priority, is transferred. da ta is then transferred continuously on channel 1 without releasing the internal bus. the bus will then switch between the two in this order: channel 1, channel 0, channel 1, channel 0, etc. that is, the bus stat e changes so that cpu cy cles are for burst-mode transfer after the data transfer in cycle steal mo de has been completed. an example of this is shown in figure 13.12. when multiple channels are in the burst mode, data transfer on the channel that has the highest priority is given precedence. when dma transfer is being performed on multiple channels, bus mastership is not released to another bus-master device until all of the competing burst-mod e transfers have been completed. cpu dma ch1 dma ch1 dma ch0 dma ch1 dma ch0 dma ch1 dma ch1 cpu ch0 ch1 ch0 cycle-steal mode in dmac ch0 and ch1 dmac ch1 burst mode cpu cpu priority: ch0 > ch1 ch0: cycle-steal mode ch1: burst mode dmac ch1 burst mode figure 13.12 bus state when mu ltiple channels are operating in the round-robin mode, do not mix channels in the cycle steal and burst modes. in this case, although the transfer operation on each channel will be pe rformed correctly, switching between channels might not correctly follow the priority order. 13.4.5 number of bus cycle states and dreq pin sampling timing number of bus cycle states: when the dmac is the bus master, the number of bus cycle states is controlled by the bus state controller (bsc) in the same way as when the cpu is the bus master. for details, see section 12, bus state controller (bsc). dreq pin sampling timing: figures 13.13 to 13.16 show the dreq input sampling timings in each bus mode.
section 13 direct memory access controller (dmac) rev. 4.00 sep. 14, 2005 page 441 of 982 rej09b0023-0400 ckio 1st acceptance 2nd acceptance acceptance start bus cycle dreq (rising) dack (active-high) cpu cpu cpu dmac non sensitive period figure 13.13 example of dreq input detection in cycle steal mode edge detection ckio bus cycle bus cycle dreq (rising) dack (active-high) dreq (overrun 1 at high level) dack (active-high) cpu cpu cpu dmac ckio cpu cpu cpu dmac 1st acceptance 2nd acceptance 1st acceptance 2nd acceptance acceptance start acceptance start non sensitive period non sensitive period figure 13.14 example of dreq input detection in cycle st eal mode level detection ckio dreq dack cpu cpu dmac dmac bus cycle non sensitive period burst acceptance figure 13.15 example of dreq input detection in burst mode edge detection
section 13 direct memory access controller (dmac) rev. 4.00 sep. 14, 2005 page 442 of 982 rej09b0023-0400 ckio cpu cpu dmac ckio cpu cpu dmac dmac 1st acceptance 1st acceptance acceptance start acceptance start acceptance start bus cycle dreq (rising) dack (active-high) bus cycle dreq (overrun 1 at high level) dack (active-high) non sensitive period non sensitive period 2nd acceptance 2nd acceptance 3rd acceptance figure 13.16 example of dreq input detection in burst mode level detection figure 13.17 shows the tend output timing. ckio dack dreq tend bus cycle end of dma transfer dmac cpu cpu cpu dmac figure 13.17 example of dreq input detection in burst mode level detection
section 13 direct memory access controller (dmac) rev. 4.00 sep. 14, 2005 page 443 of 982 rej09b0023-0400 to execute a longword access to an 8-bit or 16-bit extern al device or to execute a word access to an 8-bit external device, the dack and tend outputs are divided for data alignment as shown in figure 13.18. ckio address dackn tendn wait csn t 1 t 2 t aw t 1 t 2 (active low) (active low) note: tend is asserted for the last transfer unit of dma transfers. if a transfer unit is divided into multiple bus cycles and if csn is negated during the bus cycle, tend is also divided. rd d15 to d0 wen d15 to d0 read write figure 13.18 bsc ordinary memory access (no wait, idle cycle 1, longwo rd access to 16-bit device)
section 13 direct memory access controller (dmac) rev. 4.00 sep. 14, 2005 page 444 of 982 rej09b0023-0400 13.4.6 completion of dma transfer the conditions for the completion of dma transfer differ according to whether we are considering completion of transfer on individual channels or simultaneous completion of transfer on all channels. 1. conditions for the completion of transfer on individual channels either of the following events indicates the completion of transfer on the corresponding channel. ? the value in the dma transfer count register (tcr) becomes 0. ? the dma enable bit (de) in the dma channe l control register (chcr) becomes 0. a. completion of transfer indicated by tcr = 0 the tcr value becomes 0 when the dma transf er on the correspond ing channel has been completed, and the transfer-end bit flag (te) is set to indicate this. in this case, if the interrupt enable bit (ie) has been set, a dmac interrupt (dei) request is sent to the cpu. when transferring data in 16-byte units, specify a number of transfers, as for transfers with other transfer-units. b. completion of transfer indicated by de = 0 in chcr clearing of the dma enable bit (de) of ch cr halts dma transfer on the corresponding channel. in this case, the te bit is not set. 2. concurrent completion of transfer on all channels: either of the following events indicates the conc urrent completion of tran sfer on all channels. ? the nmi flag bit (nmif) or ad dress error flag bit (ae) of the dma operation register becomes 1. ? the dma master enable bit (dme) of dmaor becomes 0. a. completion of transfer indicated by nmif = 1 or ae = 1 in dmaor when an nmi interrupt is generated or the dmac generates an address error and the nmif bit or ae bit of dmaor is set to 1, dma transfer on all channels is suspended. the contents of the dma source address register (sar), the dma destination register (dar), and the dma transfer count regi ster (tcr) are updated (includi ng that of the channel on which the address error occurred ) by the transfer immediately before the suspension. if the transfer is the final tr ansfer, te becomes 1 and the transfer is then co mpleted. if an address error is generated during transfer in the du al address mode, pay attention on the following points.
section 13 direct memory access controller (dmac) rev. 4.00 sep. 14, 2005 page 445 of 982 rej09b0023-0400 ? when an address error occurs during a read cycle: neither read cycles nor write cycles are gene rated; only the transfer request is cleared. however, when the transfer-request source was an on-chip peripheral module (mtu), use whichever of the following methods is ap propriate to clear the transfer request. a. when the tc bit of chcr is 1: clear the co rresponding flag to re sume a transfer after address-error exception proce ssing. in this case, the transfer on the corresponding channel resumes when the de bit is set to 1. if you do not want transfer to resume on a channel, perform a dummy transfer on that chan nel to clear the transf er request; do this by setting 1 in tcr and dummy addresses in the sar and dar. b. when the tc bit of chcr is 0: use software to clear the transfer -request flag of the mtu. ? when an address error occurs during a write cycle: only read cycles are generated and the tran sfer request is cleared . however, when the transfer-request source is the on-chip peripheral module (mtu) and the tc bit of chcrn is set to 1, clear the transfer reques t by software, in the same way as when an address error occurs during a r ead cycle, described above. b. completion of transfer by clearing dme of dmaor to 0 when the dme bit of dmaor is cleared to 0, dma transfer on all channels is forcibly suspended after the current transfer has been completed. if the suspended transfer was the final transfer, te is set to 1 and the transfer is then completed. 13.4.7 notes on usage 1. clear the de bit for the corresponding channel before changing the value in the channel control register (chcr) for that channel of the dmac. 2. do not place the system in so ftware standby mode during dm a transfer and do not select module standby mode by setting the module standby bit of the dmac. clear the de bits of all channels before any transition to the software standby mode or module standby mode. 3. ensure that the system is in the normal oper ating state for the execu tion of any dma transfer where locations in the u memory or x/y memory ar e selected as the source s or destinations of the data. while the dmac can operate in sleep mode, the u memory and x/y memory are in the operation-stopped state. accordingly, access from the dmac is not possible. 4. the same internal request cannot be set for multiple channels. 5. the transfer request should be implemented after the settings of registers in dmac have been completed.
section 13 direct memory access controller (dmac) rev. 4.00 sep. 14, 2005 page 446 of 982 rej09b0023-0400 6. note the followings when the dma tran sfer request is sent from the scif. even when the dmac has completed the tcr times of transfers (the te bit in chcr = 1), the dmac accepts and keeps the transfer reques t from the scif (max. one time of transfer) if all the conditions shown below are satisfied. the dma transfer, however, is not executed because the te bit is set to 1. clearing the te bit in this condition ca n immediately restart the transfer. conditions that make the dma transfer request acceptable: ? the dme bit in the dma operation register (dmaor) is set to 1. ? the de bit in the dma channel contro l register (chcr) is set to 1. ? the peripheral module scif is set to the dma extension resource selector (dmars). take special care when the scif transfer is executed by the dmac. if the transfer restart is not desired, prevent the transfer from restarting by implementing one of the measures shown below. preventive measures: ? clear the de bit of chcr in the end interrupt routine of the dmac. (the dma transfer request from the scif is not accepted.) in this case, set the end interrupt of the dmac to have the highest priority. ? set 1 to tcr, and dummy addresses to sar and dar, respectively. then perform the dummy transfer to clear the transfer request in the dmac. 13.4.8 notes on dreq sampling when dack is divided in external access (1) error phenomenon when the dack output is divided in an exte rnal access, dreq may be sampled twice at maximum in the external access. (2) error conditions and phenomenon conditions: the dack output is divided in an external access when: ? 16-byte access, ? 32-bit access to the 8-bit space, ? 16-bit access to the 8-bit space, or ? 32-bit access to the 16-bit space is performed with either of the following idle cycle settings made: ? idle cycles between write-write cycles (iww = 01 or more)
section 13 direct memory access controller (dmac) rev. 4.00 sep. 14, 2005 page 447 of 982 rej09b0023-0400 ? idle cycles between read-read cycles in the same spaces (iwrrs = 01 or more) ? external wait mask specification (wm = 0). in addition to the above conditions, the following conditions are included depending on the detection method of dreq. ? for dreq level detection: only write access ? for dreq edge detection: both write access and read access phenomenon: the detection timings of the dreq pin in the abov e access are shown in figures 13.19 to 13.22. ckio cpu dmac write or read bus cycle non-sensitive period 1st acceptance 2nd acceptance 3rd acceptance possible non-sensitive period dreq (rising edge) dack (high-active) figure 13.19 example of dreq input det ection in cycle steal mode edge detection when dack is divided to 4 by idle cycles cpu dmac write or read non-sensitive period 1st acceptance 2nd acceptance 3rd acceptance is after the next dack assertion non-sensitive period ckio bus cycle dreq (rising edge) dack (high-active) figure 13.20 example of dreq input det ection in cycle steal mode edge detection when dack is divided to 2 by idle cycles
section 13 direct memory access controller (dmac) rev. 4.00 sep. 14, 2005 page 448 of 982 rej09b0023-0400 cpu dmac write non-sensitive period 1st acceptance 2nd acceptance 3rd acceptance possible non-sensitive period cpu dmac write non-sensitive period 1st acceptance 2nd acceptance 3rd acceptance possible non-sensitive period ckio bus cycle dreq (overrun 0, high-level) dack (high-active) dreq (overrun 1, high-level) dack (high-active) ckio bus cycle figure 13.21 example of dreq input det ection in cycle steal mode level detection when dack is divided to 4 by idle cycles
section 13 direct memory access controller (dmac) rev. 4.00 sep. 14, 2005 page 449 of 982 rej09b0023-0400 cpu cpu dmac write dmac write non-sensitive period 1st acceptance 2nd acceptance 3rd acceptance possible 3rd acceptance possible non-sensitive period non-sensitive period 1st acceptance 2nd acceptance non-sensitive period dreq (overrun 1, high-level) dack (high-active) ckio bus cycle dreq (overrun 0, high-level) dack (high-active) ckio bus cycle figure 13.22 example of dreq input det ection in cycle steal mode level detection when dack is divided to 2 by idle cycles (3) notes for the external access described in (2) above, note the following. 1. when the dreq edge is detected, input on e dreq edge at maximum in the bus cycle. 2. when the dreq level is detected in overrun 0, negate the dreq input in the bus cycle after the detection of the first dack output negation and before the second dack output negation. 3. when the dreq level is detected in overrun 1, negate dreq input after the detection of the first dack output assertion and before the second dack output assertion.
section 13 direct memory access controller (dmac) rev. 4.00 sep. 14, 2005 page 450 of 982 rej09b0023-0400
section 14 u memory rev. 4.00 sep. 14, 2005 page 451 of 982 rej09b0023-0400 section 14 u memory this lsi has on-chip u memory. it can be used by the cpu, dsp, and dmac to store instructions or data. 14.1 features the u memory features ar e listed in table 14.1. table 14.1 u memo ry specifications parameter features addressing method mapping is possible in space p0 or p2 ports 2 independent read/write ports ? 8-/16-/32-bit access from the cpu (via l bus or i bus) ? 16-/32-bit access from the dsp (via l bus or i bus) ? 8-/16-32-bit access from the cpu (via i bus) size 128 kbytes the u memory resides in addresses h ' 055f0000 to h ' 0560ffff in space p0 or addresses h ' a55f0000 to h ' a560ffff (128 kbytes) in space p2. the u memory is divided into page 0 and page 1 according to the addresses. the u memory can be accessed from the l bus and i bus. in the event of simultaneous accesses to the same address from different buses, the priority order is : i bus > l bus. since this kind of conflict tends to lower u memory accessibility, it is advisable to provide software measures to prevent such conf lict as far as possible. for example, conflict will not arise if different memory or di fferent pages are accessed by each bus. u memory is accessed by the cpu or dsp from sp ace p0 via the i bus, a conflict with the dmac may occur on the i bus. since this kind of conflict also tends to lower u me mory accessibility, it is advisable to provide software measures to preven t such conflict as far as possible. for example, conflict on the i bus can be prevented by usin g space p2 when the u me mory is accessed by the cpu or dsp.
section 14 u memory rev. 4.00 sep. 14, 2005 page 452 of 982 rej09b0023-0400 14.2 u memory access from cpu the u memory can be accessed by the cpu from spaces p0 and p2. access from the cpu is via the i bus when u memory is sp ace p0, and via the l bus when sp ace p2. to use the l bus, one cycle access is performed unless page conflict occurs . using the i bus takes more than one cycle. area1, 64 mbytes u memory space address a[28:0] address a[28:0] i/o space 16 mbytes x/y memory reserved reserved h'04000000 h'05000000 h'0501ffff h'055f0000 h'0560ffff h'05610000 h'07ffffff u memory page1 64 kbytes u memory page0 64 kbytes h'0560ffff h'05600000 h'055fffff h'055f0000 figure 14.1 u memory address mapping 14.3 u memory access from dsp the dsp can access the u memory through spaces p0 and p2 using a single data transfer instruction. access from the dsp is via the i bus when the address is spac e p0, and via the l bus when the address is space p2. to use the l bus, one cycle access is performed unless page conflict occurs. using the i bus takes more than one cycle. 14.4 u memory access from dmac the u memory also exists on the i bus an d can be accessed by the dmac. use addresses h ' 55f0000 to h ' 560ffff.
section 14 u memory rev. 4.00 sep. 14, 2005 page 453 of 982 rej09b0023-0400 14.5 usage note when accessing the u memory by the cpu or th e dsp, if the cache is on, access must be performed from space p2 (non-cacheable space). operation duri ng access from space p0 cannot be guaranteed. when the cache is off, sp aces p0 and p2 can both be used. 14.6 sleep mode in sleep mode, the u memory cannot be accessed by the i bus master m odule such as dmac. 14.7 address error when an address error in write access to the u me mory occur, the contents of the u memory may be corrupted.
section 14 u memory rev. 4.00 sep. 14, 2005 page 454 of 982 rej09b0023-0400
section 15 user debugging interface (h-udi) rev. 4.00 sep. 14, 2005 page 455 of 982 rej09b0023-0400 section 15 user debu gging interface (h-udi) this lsi incorporates a user debugging interface (h-udi) and advanced us er debugger (aud) for a boundary scan function and emulator support. this section describes the h-udi. the aud is a function exclusively fo r use by an emulator. refer to the user's manual for the relevant emulator for details of the aud. 15.1 features the user debugging interface (h-u di) is a serial i/o interface wh ich conforms to jtag (joint test action group, ieee standard 1149.1 and ieee standard test access port and boundary- scan architecture) specifications. the h-udi in this lsi supports a boundary scan mode, and is also used for emulator connection. when using an emulator, h-udi functions should not be used. refer to the emulator manual for the method of conn ecting the emulator. figure 15.1 shows a block diagram of the h-udi. sdir sdid tck tdo tdi tms sdbpr mux sdbsr shift register tap controller decoder local bus t rst figure 15.1 block diagram of h-udi
section 15 user debugging interface (h-udi) rev. 4.00 sep. 14, 2005 page 456 of 982 rej09b0023-0400 15.2 input/output pins table 15.1 shows the pin configuration of the h-udi. table 15.1 pin configuration pin name input/output description tck input serial data input/output clock pin data is serially supplied to the h-udi from the data input pin (tdi), and output from the data output pin (tdo), in synchronization with this clock. tms input mode select input pin the state of the tap control circuit is determined by changing this signal in synchronization with tck. the protocol conforms to the jtag standard (ieee std.1149.1). trst input reset input pin input is accepted asynchronously with respect to tck, and when low, the h-udi is reset. trst must be low for a constant period when power is turned on regardless of using the h-udi function. this is di fferent from the jtag standard. see section 15.4.2, reset confi guration, for more information. tdi input serial data input pin data transfer to the h-udi is executed by changing this signal in synchronization with tck. tdo output serial data output pin data read from the h-udi is executed by reading this pin in synchronization with tck. the data output timing depends on the command type set in the sdir. see section 15.3.2 instruction register (sdi r), for more information. asemd0 * input ase mode select pin if a low level is input at the asemd0 pin while the resetp pin is asserted, ase mode is entered; if a high level is input, normal mode is entered. in ase mode, dedicated emulator function can be used. the input level at the asemd0 pin should be held for at least one cycle after resetp negation. asebrkak, audsync , audata3 to audata 0, audck output dedicated emulator pin note: * when the emulator is not in use, fix this pin to the high level.
section 15 user debugging interface (h-udi) rev. 4.00 sep. 14, 2005 page 457 of 982 rej09b0023-0400 15.3 register descriptions the h-udi has the following registers. refer the s ection 24, list of registers, for the addresses and access size for these registers. ? bypass register (sdbpr) ? instruction register (sdir) ? boundary scan register (sdbsr) ? id register (sdid) 15.3.1 bypass register (sdbpr) sdbpr is a 1-bit register that cannot be accessed by the cpu. when sdir is set to the bypass mode, sdbpr is connected between h-udi pins tdi and tdo. the initial value is undefined but is initialized to 0 if the tap is in capture-dr state. 15.3.2 instruction register (sdir) sdir is a 16-bit read-only register . the register is in jtag idcode in its initial state. it is initialized by trst assertion or in the tap test-logic-reset state, and can be written to by the h- udi irrespective of the cpu mode. operation is not guaranteed if a reserved command is set in this register. bit bit name initial value r/w description 15 to 13 ti7 to ti5 all 1 r 12 ti4 0 r 11 to 8 ti3 to ti0 all 1 r test instruction 7 to 0 the h-udi instruction is transferred to sdir by a serial input from tdi. for commands, see table 15.2. 7 to 2 ? all 1 r reserved these bits are always read as 1. 1 ? 0 r reserved this bit is always read as 0. 0 ? 1 r reserved this bit is always read as 1.
section 15 user debugging interface (h-udi) rev. 4.00 sep. 14, 2005 page 458 of 982 rej09b0023-0400 table 15.2 h-udi commands bits 15 to 8 ti7 ti6 ti5 ti4 ti3 ti 2 ti1 ti0 description 0 0 0 0 ? ? ? ? jtag extest 0 0 1 0 ? ? ? ? jtag clamp 0 0 1 1 ? ? ? ? jtag highz 0 1 0 0 ? ? ? ? jtag sample/preload 0 1 1 0 ? ? ? ? h-udi reset negate 0 1 1 1 ? ? ? ? h-udi reset assert 1 0 1 ? ? ? ? ? h-udi interrupt 1 1 1 0 ? ? ? ? jtag idcode (initial value) 1 1 1 1 ? ? ? ? jtag bypass other than the above reserved 15.3.3 boundary scan register (sdbsr) sdbsr is a 469-bit shift register, located on the pa d, for controlling the input/output pins of this lsi. using the extest, sample/preload, clamp, and highz commands, a boundary scan test conforming to the jtag standard can be carried out. table 15.3 s hows the correspondence between this lsi's pins and boundary scan register bits.
section 15 user debugging interface (h-udi) rev. 4.00 sep. 14, 2005 page 459 of 982 rej09b0023-0400 table 15.3 this lsi pins and boundary scan register bits bit pin name i/o bit pin name i/o from tdi 454 audata3/ptj11 in 483 d7 in 453 audsync/ptj12 in 482 d6 in 452 nmi in 481 d5 in 451 irq0 /ptj0 in 480 d4 in 450 irq1 /ptj1 in 479 d3 in 449 irq2 /ptj2 in 478 d2 in 448 irq3 /ptj3 in 477 d1 in 447 irq4 /ptj4 in 476 d0 in 446 irq5 /ptj5 in 475 cs3 /pta3 in 445 irq6 /ptj6 in 474 cs2 /pta2 in 444 irq7 /ptj7 in 473 uclk/ptb0 in 443 sck0/pth0 in 472 vbus/ptb1 in 442 d7 out 471 suspnd/ptb2 in 441 d6 out 470 xvdata/ptb3 in 440 d5 out 469 txenl/ptb4 in 439 d4 out 468 txdmns/ptb5 in 438 d3 out 467 txdpls/ptb6 in 437 d2 out 466 dmns/ptb7 in 436 d1 out 465 dpls/ptb8 in 435 d0 out 464 a19/pta8 in 434 cs3 /pta3 out 463 a20/pta9 in 433 cs2 /pta2 out 462 a21/pta10 in 432 uclk/ptb0 out 461 a22/pta11 in 431 vbus/ptb1 out 460 a23/pta12 in 430 suspnd/ptb2 out 459 a24/pta13 in 429 xvdata/ptb3 out 458 a25/pta14 in 428 txenl/ptb4 out 457 audata0/ptj8 in 427 txdmns/ptb5 out 456 audata1/ptj9 in 426 txdpls/ptb6 out 455 audata2/ptj10 in 425 dmns/ptb7 out
section 15 user debugging interface (h-udi) rev. 4.00 sep. 14, 2005 page 460 of 982 rej09b0023-0400 bit pin name i/o bit pin name i/o 424 dpls/ptb8 out 392 cs3 /pta3 control 423 a18 out 391 cs2 /pta2 control 422 a19/pta8 out 390 uclk/ptb0 control 421 a20/pta9 out 389 vbus/ptb1 control 420 a21/pta10 out 388 suspnd/ptb2 control 419 a22/pta11 out 387 xvdata/ptb3 control 418 a23/pta12 out 386 t xenl/ptb4 control 417 a24/pta13 out 385 txdmns/ptb5 control 416 audck out 384 txdpls/ptb6 control 415 a25/pta14 out 383 dmns/ptb7 control 414 audata0/ptj8 out 382 dpls/ptb8 control 413 audata1/ptj9 out 381 a18 control 412 audata2/ptj10 out 380 a19/pta8 control 411 audata3/ptj11 out 379 a20/pta9 control 410 audsync /ptj12 out 378 a21/pta10 control 409 irq0 /ptj0 out 377 a22/pta11 control 408 irq1 /ptj1 out 376 a23/pta12 control 407 irq2 /ptj2 out 375 a24/pta13 control 406 irq3 /ptj3 out 374 audck control 405 irq4 /ptj4 out 373 a25/pta14 control 404 irq5 /ptj5 out 372 audata0/ptj8 control 403 irq6 /ptj6 out 371 audata1/ptj9 control 402 irq7 /ptj7 out 370 audata2/ptj10 control 401 sck0/pth0 out 369 audata3/ptj11 control 400 d7 control 368 audsync/ptj12 control 399 d6 control 367 irq0 /ptj0 control 398 d5 control 366 irq1 /ptj1 control 397 d4 control 365 irq2 /ptj2 control 396 d3 control 364 irq3 /ptj3 control 395 d2 control 363 irq4 /ptj4 control 394 d1 control 362 irq5 /ptj5 control 393 d0 control 361 irq6 /ptj6 control
section 15 user debugging interface (h-udi) rev. 4.00 sep. 14, 2005 page 461 of 982 rej09b0023-0400 bit pin name i/o bit pin name i/o 360 irq7 /ptj7 control 328 tclkd/ptf8 in 359 sck0/pth0 control 327 tclkc/ptf9 in 358 cts0 /pth1 in 326 tclkb/ptf10 in 357 txd0/pth2 in 325 tclka/ptf11 in 356 rxd0/pth3 in 324 poe0 /ptf12 in 355 rts0 /pth4 in 323 poe1 /ptf13 in 354 sck1/pth5 in 322 poe2 /ptf14 in 353 cts1 /pth6 in 321 poe3 /ptf15 in 352 txd1/pth7 in 320 ptf0 in 351 rxd1/pth8 in 319 ptf1 in 350 rts1 /pth9 in 318 ptf2 in 349 sck2/pth10 in 317 ptf3 in 348 cts2 /pth11 in 316 ptf4 in 347 txd2/pth12 in 315 ptf5 in 346 rxd2/pth13 in 314 ptf6 in 345 rts2 /pth14 in 313 ptf7 in 344 tioc4d/pte0 in 312 ptg8 in 343 tioc4c/pte1 in 311 ptg9/scl in 342 tioc4b/pte2 in 310 ptg10/sda in 341 tioc4a/pte3 in 309 ptg11 in 340 tioc3d/pte4 in 308 ptg12 in 339 tioc3b/pte6 in 307 ptg13 in 338 tioc3c/pte5 in 306 cts0 /pth1 out 337 tioc3a/pte7 in 305 txd0/pth2 out 336 tioc2b/pte8 in 304 rxd0/pth3 out 335 tioc2a/pte9 in 303 rts0 /pth4 out 334 tioc1b/pte10 in 302 sck1/pth5 out 333 tioc1a/pte11 in 301 cts1 /pth6 out 332 tioc0d/pte12 in 300 txd1/pth7 out 331 tioc0c/pte13 in 299 rxd1/pth8 out 330 tioc0b/pte14 in 298 rts1 /pth9 out 329 tioc0a/pte15 in 297 sck2/pth10 out
section 15 user debugging interface (h-udi) rev. 4.00 sep. 14, 2005 page 462 of 982 rej09b0023-0400 bit pin name i/o bit pin name i/o 296 cts2 /pth11 out 264 ptf4 out 295 txd2/pth12 out 263 ptf5 out 294 rxd2/pth13 out 262 ptf6 out 293 rts2 /pth14 out 261 ptf7 out 292 tioc4d/pte0 out 260 ptg8 out 291 tioc4c/pte1 out 259 ptg9/scl out 290 tioc4b/pte2 out 258 ptg10/sda out 289 tioc4a/pte3 out 257 ptg11 out 288 tioc3d/pte4 out 256 ptg12 out 287 tioc3b/pte6 out 255 ptg13 out 286 tioc3c/pte5 out 254 cts0 /pth1 control 285 tioc3a/pte7 out 253 txd0/pth2 control 284 tioc2b/pte8 out 252 rxd0/pth3 control 283 tioc2a/pte9 out 251 rts0 /pth4 control 282 tioc1b/pte10 out 250 sck1/pth5 control 281 tioc1a/pte11 out 249 cts1 /pth6 control 280 tioc0d/pte12 out 248 txd1/pth7 control 279 tioc0c/pte13 out 247 rxd1/pth8 control 278 tioc0b/pte14 out 246 rts1 /pth9 control 277 tioc0a/pte15 out 245 sck2/pth10 control 276 tclkd/ptf8 out 244 cts2 /pth11 control 275 tclkc/ptf9 out 243 txd2/pth12 control 274 tclkb/ptf10 out 242 rxd2/pth13 control 273 tclka/ptf11 out 241 rts2 /pth14 control 272 poe0 /ptf12 out 240 tioc4d/pte0 control 271 poe1 /ptf13 out 239 tioc4c/pte1 control 270 poe2 /ptf14 out 238 tioc4b/pte2 control 269 poe3 /ptf15 out 237 tioc4a/pte3 control 268 ptf0 out 236 tioc3d/pte4 control 267 ptf1 out 235 tioc3b/pte6 control 266 ptf2 out 234 tioc3c/pte5 control 265 ptf3 out 233 tioc3a/pte7 control
section 15 user debugging interface (h-udi) rev. 4.00 sep. 14, 2005 page 463 of 982 rej09b0023-0400 bit pin name i/o bit pin name i/o 232 tioc2b/pte8 control 200 an2/ptg2 in 231 tioc2a/pte9 control 199 an3/ptg3 in 230 tioc1b/pte10 control 198 an4/ptg4 in 229 tioc1a/pte11 control 197 an5/ptg5 in 228 tioc0d/pte12 control 196 an6/ptg6 in 227 tioc0c/pte13 control 195 an7/ptg7 in 226 tioc0b/pte14 control 194 dreq0 /ptc9 in 225 tioc0a/pte15 control 193 dreq1 /ptc10 in 224 tclkd/ptf8 control 192 status0/ptc14 in 223 tclkc/ptf9 control 191 status1/ptc15 in 222 tclkb/ptf10 control 190 breq /ptc6 in 221 tclka/ptf11 control 189 back /ptc7 in 220 poe 0/ptf12 control 188 *vccq in 219 poe 1/ptf13 control 187 *vccq in 218 poe 2/ptf14 control 186 asebrkak/ptc13 in 217 poe 3/ptf15 control 185 md3 in 216 ptf0 control 184 md2 in 215 ptf1 control 183 *vccq in 214 ptf2 control 182 md0 in 213 ptf3 control 181 cs6b /ptc4 in 212 ptf4 control 180 cs6a /ptc3 in 211 ptf5 control 179 cs5b /ptc2 in 210 ptf6 control 178 cs5a /ptc1 in 209 ptf7 control 177 cs4 /ptc0 in 208 ptg8 control 176 wait in 207 ptg9/scl control 175 tend/ptc8 in 206 ptg10/sda control 174 frame /ptc5 in 205 ptg11 control 173 dack0 /ptc11 in 204 ptg12 control 172 dack1 /ptc12 in 203 ptg13 control 171 d31/ptd15 in 202 an0/ptg0 in 170 d30/ptd14 in 201 an1/ptg1 in 169 d29/ptd13 in
section 15 user debugging interface (h-udi) rev. 4.00 sep. 14, 2005 page 464 of 982 rej09b0023-0400 bit pin name i/o bit pin name i/o 168 d28/ptd12 in 136 breq /ptc6 control 167 d27/ptd11 in 135 back /ptc7 control 166 d26/ptd10 in 134 asebrkak/ptc13 control 165 dreq0 /ptc9 out 133 cs6b /ptc4 control 164 dreq1 /ptc10 out 132 cs6a /ptc3 control 163 status0/ptc14 out 131 cs5b /ptc2 control 162 status1/ptc15 out 130 cs5a /ptc1 control 161 breq /ptc6 out 129 cs4 /ptc0 control 160 back /ptc7 out 128 cs0 control 159 asebrkak /ptc13 out 127 bs control 158 cs6b /ptc4 out 126 tend/ptc8 control 157 cs6a /ptc3 out 125 frame /ptc5 control 156 cs5b /ptc2 out 124 rd control 155 cs5a /ptc1 out 123 dack0 /ptc11 control 154 cs4 /ptc0 out 122 dack1 /ptc12 control 153 cs0 out 121 d31/ptd15 control 152 bs out 120 d30/ptd14 control 151 tend /ptc8 out 119 d29/ptd13 control 150 frame /ptc5 out 118 d28/ptd12 control 149 rd out 117 d27/ptd11 control 148 dack0 /ptc11 out 116 d26/ptd10 control 147 dack1 /ptc12 out 115 d25/ptd9 in 146 d31/ptd15 out 114 d24/ptd8 in 145 d30/ptd14 out 113 d23/ptd7 in 144 d29/ptd13 out 112 d22/ptd6 in 143 d28/ptd12 out 111 d21/ptd5 in 142 d27/ptd11 out 110 d20/ptd4 in 141 d26/ptd10 out 109 d19/ptd3 in 140 dreq0 /ptc9 control 108 d18/ptd2 in 139 dreq1 /ptc10 control 107 d17/ptd1 in 138 status0/ptc14 cont rol 106 d16/ptd0 in 137 status1/ptc15 control 105 casu /pta5 in
section 15 user debugging interface (h-udi) rev. 4.00 sep. 14, 2005 page 465 of 982 rej09b0023-0400 bit pin name i/o bit pin name i/o 104 rasu /pta7 in 72 rasl /pta6 out 103 cke/pta1 in 71 a17 out 102 casl /pta4 in 70 a16 out 101 rasl /pta6 in 69 a15 out 100 a0/pta0 in 68 a14 out 99 d15 in 67 a13 out 98 d14 in 66 a12 out 97 d13 in 65 a11 out 96 d12 in 64 a10 out 95 d11 in 63 a9 out 94 d10 in 62 a8 out 93 d9 in 61 a7 out 92 d8 in 60 a6 out 91 d25/ptd9 out 59 a5 out 90 d24/ptd8 out 58 a4 out 89 d23/ptd7 out 57 a3 out 88 d22/ptd6 out 56 a2 out 87 d21/ptd5 out 55 a1 out 86 d20/ptd4 out 54 a0/pta0 out 85 d19/ptd3 out 53 d15 out 84 d18/ptd2 out 52 d14 out 83 d17/ptd1 out 51 d13 out 82 d16/ptd0 out 50 d12 out 81 rdwr out 49 d11 out 80 we0 /dqmll out 48 d10 out 79 we1 /dqmlu out 47 d9 out 78 casu /pta5 out 46 d8 out 77 we3 /dqmuu/ ah out 45 d25/ptd9 control 76 rasu /pta7 out 44 d24/ptd8 control 75 we2 /dqmul out 43 d23/ptd7 control 74 cke/pta1 out 42 d22/ptd6 control 73 casl /pta4 out 41 d21/ptd5 control
section 15 user debugging interface (h-udi) rev. 4.00 sep. 14, 2005 page 466 of 982 rej09b0023-0400 bit pin name i/o bit pin name i/o 40 d20/ptd4 control 19 a11 control 39 d19/ptd3 control 18 a10 control 38 d18/ptd2 control 17 a9 control 37 d17/ptd1 control 16 a8 control 36 d16/ptd0 control 15 a7 control 35 rd/ wr control 14 a6 control 34 we0 /dqmll control 13 a5 control 33 we1 /dqmlu control 12 a4 control 32 casu /pta5 control 11 a3 control 31 we3 /dqmuu/ ah control 10 a2 control 30 rasu /pta7 control 9 a1 control 29 we2 /dqmul control 8 a0/pta0 control 28 cke/pta1 control 7 d15 control 27 casl /pta4 control 6 d14 control 26 rasl /pta6 control 5 d13 control 25 a17 control 4 d12 control 24 a16 control 3 d11 control 23 a15 control 2 d10 control 22 a14 control 1 d9 control 21 a13 control 0 d8 control 20 a12 control to tdo notes: 1. control is an active-high signal. 2. when control is driven high, the corresponding pin is driven by the value of out. 3. * vccq is not the power supply for the lsi, but is still necessary for operation of the user functions. accordingly, pull this pin up in t he way described in the specifications. these pins must be pulled-up based on the specifications.
section 15 user debugging interface (h-udi) rev. 4.00 sep. 14, 2005 page 467 of 982 rej09b0023-0400 15.3.4 id register (sdid) the id register (sdid) is a 32-bit read-only re gister in which sdidh and sdidl are connected. each register is a 16-bit that can be read by cpu. the idcode command is set from the h-udi pin. this register can be read from the tdo when the tap state is shift-dr. writing is disabled. bit bit name initial value r/w description 31 to 0 did31 to did0 h'0027200f r device id device id register that is stipulated by jtag. h'0027200f is initial value specific to the lsi. upper four bits may be changed by the chip version. sdidh corresponds to bits 31 to 16. sdidl corresponds to bits 15 to 0.
section 15 user debugging interface (h-udi) rev. 4.00 sep. 14, 2005 page 468 of 982 rej09b0023-0400 15.4 operation 15.4.1 tap controller figure 15.2 shows the internal states of the tap controller. state transitions basically conform with the jtag standard. test-logic-reset capture-dr shift-dr exit1-dr pause-dr exit2-dr update-dr select-dr-scan run-test/idle 1 0 0 0 0 11 1 0 0 1 0 1 1 1 0 capture-ir shift-ir exit1-ir pause-ir exit2-ir update-ir select-ir-scan 0 0 1 0 0 1 0 1 1 10 0 figure 15.2 tap controller state transitions note: the transition condition is the tms value at the rising edge of tck. the tdi value is sampled at the rising edge of tck; shifting occurs at the falling edge of tck. for details on change timing of the tdo value, see sect ion 15.4.3, tdo output timing. the tdo is at high impedance, except with shift-dr and shift-ir states. during the change to trst = 0, there is a transition to test-logic-reset asynchronously with tck.
section 15 user debugging interface (h-udi) rev. 4.00 sep. 14, 2005 page 469 of 982 rej09b0023-0400 15.4.2 reset configuration table 15.4 reset configuration asemd0 * 1 resetp trst chip state h l l normal reset and h-udi reset h normal reset h l h-udi reset only h normal operation l l l reset hold * 2 h normal reset h l h-udi reset only h normal operation notes: 1. performs normal mode and ase mode settings asemd0 = h, normal mode asemd0 = l, ase mode 2. in ase mode, reset hold is entered if the trst pin is driven low while the resetp pin is negated. in this state, the cpu does not start up. when trst is driven high, h-udi operation is enabled, but the cpu does not st art up. the reset hold state is cancelled by the following: another resetp assert (power-on reset) 15.4.3 tdo output timing the timing of data output from the tdo is switched by the command type set in the sdir. the timing changes at the tck falling edge when jtag commands (extest, clamp, highz, sample/preload, idcode, and bypass) are set. this is a timing of the jtag standard. when the h-udi commands (h-udi reset negate, h-udi reset assert, and h-udi interrupt) are set, tdo is output at the tck rising edge ear lier than the jtag standa rd by a half cycle.
section 15 user debugging interface (h-udi) rev. 4.00 sep. 14, 2005 page 470 of 982 rej09b0023-0400 tdo (when the h-udi command is set) tck tdo (when the boundary scan command is set) t tdod t tdod figure 15.3 h-udi data transfer timing 15.4.4 h-udi reset an h-udi reset is executed by inputting an h-udi reset assert command in sdir. an h-udi reset is of the same kind as a power-on reset. an h-udi reset is released by inputting an h-udi reset negate command. the required time between the h-udi reset assert command and h-udi reset negate command is the same as time for keeping the resetp pin low to apply a power-on reset. h-udi reset assert h-udi reset negate sdir chip internal reset cpu state branch to h'a0000000 figure 15.4 h-udi reset 15.4.5 h-udi interrupt the h-udi interrupt function generates an interrupt by setting a command from the h-udi in the sdir. an h-udi interrupt is a general exception/interrupt operation, resulting in a branch to an address based on the vbr value plus offset, and with return by the rte instruction. this interrupt request has a fixed priority level of 15. h-udi interrupts are accepted in sleep mode.
section 15 user debugging interface (h-udi) rev. 4.00 sep. 14, 2005 page 471 of 982 rej09b0023-0400 15.5 boundary scan a command can be set in sdir by the h-udi to place the h-udi pins in the boundary scan mode stipulated by jtag. 15.5.1 supported instructions this lsi supports the three essential instructi ons defined in the jtag standard (bypass, sample/preload, and extest) and three op tion instructions (idcode, clamp, and highz). bypass: the bypass instruction is an essential sta ndard instruction that operates the bypass register. this instruction shortens the shift path to speed up serial data transfer involving other chips on the printed circuit board. while this instru ction is executing, the test circuit has no effect on the system circuits. the upper four b its of the instruction code are b'1111. sample/preload: the sample/preload instruction inputs values from this lsi's internal circuitry to the boundary scan register, outputs values fr om the scan path, and loads data onto the scan path. when this instruction is execu ting, this lsi's input pin signals are transmitted directly to the internal circuitry, and internal circuit values are directly output externally from the output pins. this lsi's system circuits are not affected by execution of this instruction. the upper four bits of the instruction code are b'0100. in a sample operation, a snapshot of a value to be transferred from an input pin to the internal circuitry, or a value to be transferred from the intern al circuitry to an output pin, is latched into the boundary scan register and read from the scan path. snapshot latching is performed in synchronization with the rise of tck in the capture-dr state. snapshot latching does not affect normal operation of this lsi. in a preload operation, an initial value is set in the parallel output latch of the boundary scan register from the scan path prior to the extest instruction. without a preload operation, when the extest instruction was executed an undefined value would be output from the output pin until completion of the initial scan sequence (transfer to the output latch) (with the extest instruction, the parallel output latch value is constantly output to the output pin).
section 15 user debugging interface (h-udi) rev. 4.00 sep. 14, 2005 page 472 of 982 rej09b0023-0400 extest: this instruction is provided to test external circuitry when the this lsi is mounted on a printed circuit board. when this instruction is executed, output pins are used to output test data (previously set by the sample/preload instruction) from the boundary scan register to the printed circuit board, and input pins are used to latch test results into the boundary scan register from the printed circuit board. if testing is carri ed out by using the extest instruction n times, the nth test data is scanned-in when test data (n-1) is scanned out. data loaded into the output pin boundary scan register in the capture-dr state is not used for external circuit testing (it is replaced by a shift operation). the upper four bits of the instruction code are b'0000. idcode: a command can be set in sdir by the h- udi pins to place the h-udi pins in the idcode mode stipulated by jtag. when the h-udi is initialized ( trst is asserted or tap is in the test-logic-reset state), th e idcode mode is entered. clamp, highz: a command can be set in sdir by the h-udi pins to place the h-udi pins in the clamp or highz mode stipulated by jtag. 15.5.2 points for attention 1. boundary scan mode does not cover clock-related signals (extal, xtal, ckio, ckio2). 2. boundary scan mode does not cover reset-related signals ( resetp , resetm ). 3. boundary scan mode does not cover h-udi -related signals (tck, tdi, tdo, tms, trst ). 4. the usb-transceiver-related signals (dp, dm) are beyond the scope of the boundary scan. 5. when the extest, clamp, and highz commands are set, fix the resetp pin low. 6. when a boundary scan test for other than bypass and idcode is carried out, fix the asemd0 pin high. 15.6 usage notes 1. an h-udi command, once set, will not be modified as long as another command is not re- issued from the h-udi. if the same command is given continuously, the command must be set after a command (bypass, etc.) that does not affect chip operations is once set. 2. h-udi commands are not accepted in standby mode, since operation of the lsi is suspended. to retain the tap status before and after standby mode, keep tck high before entering standby mode. 3. the h-udi is used for emulator connection. therefore, h-udi functions cannot be used when using an emulator.
section 16 i 2 c bus interface 2 (iic2) rev. 4.00 sep. 14, 2005 page 473 of 982 rej09b0023-0400 section 16 i 2 c bus interface 2 (iic2) the i 2 c bus interface 2 conforms to and pr ovides a subset of the philips i 2 c (inter-ic) bus interface functions. however, the configuration of the re gisters that control the i 2 c bus differs partly from the philips re gister configuration. figure 16.1 shows a block diagram of the i 2 c bus interface 2. figure 16 .2 shows an example of i/o pin connections to external circuits. 16.1 features ? selection of i 2 c format or clocked synchronous serial format ? continuous transmission/reception since the shift register, transmit data register, and receive data register are independent from each other, the continuous transmi ssion/reception can be performed. i 2 c bus format: ? start and stop conditions generated automatically in master mode ? selection of acknowledge output levels when receiving ? automatic loading of acknowledge bit when transmitting ? bit synchronization/wait function in master mode, the state of scl is monitored per bit, and the timing is synchronized automatically. if transmission/reception is not yet possible, set the scl to low un til preparations are completed. ? six interrupt sources transmit data empty (including slave-address matc h), transmit end, receive data full (including slave-address match), arbitration lost, nack detection, and stop condition detection ? direct bus drive two pins, scl and sda pins, function as nmos open-drain outputs when the bus drive function is selected. clocked synchronous format: ? four interrupt sources transmit-data-empty, transmit-end, receive-data-full, and overrun error
section 16 i 2 c bus interface 2 (iic2) rev. 4.00 sep. 14, 2005 page 474 of 982 rej09b0023-0400 scl iccr1 transfer clock generation circuit address comparator interrupt generator interrupt request bus state decision circuit arbitration decision circuit noise canceler noise canceler output control output control transmission/ reception control circuit iccr2 icmr icsr icier icdrr icdrs icdrt i 2 c bus control register 1 i 2 c bus control register 2 i 2 c bus mode register i 2 c bus status register i 2 c bus interrupt enable register i 2 c bus transmit data register i 2 c bus receive data register i 2 c bus shift register slave address register nf2cyc register [legend] iccr1 : iccr2 : icmr : icsr : icier : icdrt : icdrr : icdrs : sar : nf2cyc: sar sda internal data bus nf2cyc figure 16.1 block diagram of i 2 c bus interface 2
section 16 i 2 c bus interface 2 (iic2) rev. 4.00 sep. 14, 2005 page 475 of 982 rej09b0023-0400 vccq* vccq* scl in scl out scl sda in sda out sda scl (master) (slave 1) (slave 2) sda scl in scl out scl sda in sda out sda scl in scl out scl sda in sda out sda note: * the i 2 c bus power supply and this lsi's power supply (vccq) must be switched on or off simultaneously. figure 16.2 external circu it connections of i/o pins 16.2 input/output pins table 16.1 shows the pin configuration for the i 2 c bus interface 2. table 16.1 i 2 c bus interface pin configuration name abbreviation i/o function serial clock scl i/o iic se rial clock input/output serial data sda i/o iic serial data input/output
section 16 i 2 c bus interface 2 (iic2) rev. 4.00 sep. 14, 2005 page 476 of 982 rej09b0023-0400 16.3 register descriptions the i 2 c bus interface 2 has the following registers: ? i 2 c bus control register 1 (iccr1) ? i 2 c bus control register 2 (iccr2) ? i 2 c bus mode register (icmr) ? i 2 c bus interrupt enable register (icier) ? i 2 c bus status register (icsr) ? i 2 c bus slave address register (sar) ? i 2 c bus transmit data register (icdrt) ? i 2 c bus receive data register (icdrr) ? i 2 c bus shift register (icdrs) ? nf2cyc register (nf2cyc) 16.3.1 i 2 c bus control register 1 (iccr1) iccr1 is an 8-bit readable/writable register that enables or disables the i 2 c bus interface 2, controls transmission or reception, and selects ma ster or slave mode, transmission or reception, and transfer clock frequency in master mode. iccr1 is initialized to h'00 by a power-on reset. bit bit name initial value r/w description 7 ice 0 r/w i 2 c bus interface enable 0: this module is halted. (scl and sda pins are set to port function.) 1: this bit is enabled for transfer operations. (scl and sda pins are bus drive state.) 6 rcvd 0 r/w reception disable this bit enables or disables the next operation when trs is 0 and icdrr is read. 0: enables next reception 1: disables next reception
section 16 i 2 c bus interface 2 (iic2) rev. 4.00 sep. 14, 2005 page 477 of 982 rej09b0023-0400 bit bit name initial value r/w description 5 4 mst trs 0 0 r/w r/w master/slave select transmit/receive select in master mode with the i 2 c bus format, when arbitration is lost, mst and trs are both reset by hardware, causing a transition to slave receive mode. modification of the trs bit should be made between transfer frames. when seven bits after the start condition is issued in slave receive mode match the slave address set to sar and the eighth bit is set to 1, trs is automatically set to 1. if an overrun erro r occurs in master receive mode with the clocked synchronous serial format, mst is cleared and the mode changes to slave receive mode. operating modes are described below according to mst and trs combination. when clocked synchronous serial format is selected and mst 1, clock is output. 00: slave receive mode 01: slave transmit mode 10: master receive mode 11: master transmit mode 3 2 1 0 cks3 cks2 cks1 cks0 0 0 0 0 r/w r/w r/w r/w transfer clock select 3 to 0 these bits are valid only in master mode. these bits should be set according to the necessary transfer rate. for details of transfer rate, see table 16.2.
section 16 i 2 c bus interface 2 (iic2) rev. 4.00 sep. 14, 2005 page 478 of 982 rej09b0023-0400 table 16.2 transfer rate bit 3 bit 2 bit 1 bit 0 transfer rate cks3 cks2 cks1 cks0 clock =5 mhz =10 mhz =16.5 mhz =30 mhz =33 mhz 0 0 0 0 /28 179 khz 357 khz 589khz 1071khz 1179khz 1 /40 125 khz 250 khz 413khz 750khz 825khz 1 0 /48 104 khz 208 khz 344khz 625khz 688khz 1 /64 78.1 khz 156 khz 258khz 469khz 516khz 1 0 0 /80 62.5 khz 125 khz 206khz 375khz 413khz 1 /100 50.0 khz 100 khz 165khz 300khz 330khz 1 0 /112 44.6 khz 89.3 khz 147khz 268khz 295khz 1 /128 39.1 khz 78.1 khz 129khz 234khz 258khz 1 0 0 0 /56 89.3 khz 179 khz 295khz 536khz 589khz 1 /80 62.5 khz 125 khz 206khz 375khz 413khz 1 0 /96 52.1 khz 104 khz 172khz 313khz 344khz 1 /128 39.1 khz 78.1 khz 129khz 234khz 258khz 1 0 0 /160 31.3 khz 62.5 khz 103khz 188khz 206khz 1 /200 25.0 khz 50.0 khz 82.5khz 150khz 165khz 1 0 /224 22.3 khz 44.6 khz 73.7khz 134khz 147khz 1 /256 19.5 khz 39.1 khz 64.5khz 117khz 129khz note: set the value that satisfies the external specifications.
section 16 i 2 c bus interface 2 (iic2) rev. 4.00 sep. 14, 2005 page 479 of 982 rej09b0023-0400 16.3.2 i 2 c bus control register 2 (iccr2) iccr2 is an 8-bit readable/writable register that issues start/stop conditions, manipulates the sda pin, monitors the scl pin, and controls reset in the control part of the i 2 c bus interface 2. bit bit name initial value r/w description 7 bbsy 0 r/w bus busy this bit enables to confirm whether the i 2 c bus is occupied or released and to issue start/stop conditions in master mode. with the clocked synchronous serial format, this bit has no meaning. with the i 2 c bus format, this bit is set to 1 when the sda level changes from high to low under the condition of scl = high, assuming that the start condition has been issued. this bit is cleared to 0 when the sda level changes from low to high under the condition of scl = high, assuming that the stop condition has been issued. write 1 to bbsy and 0 to scp to issue a start condition. follow this procedure when also re-transmitting a start condition. write 0 in bbsy and 0 in scp to issue a stop condition. 6 scp 1 w start/stop issue condition disable the scp bit controls the issue of start/stop conditions in master mode. to issue a start condition, write 1 in bbsy and 0 in scp. a retransmit start condition is issued in the same way. to issue a stop condition, write 0 in bbsy and 0 in scp. this bit is always read as 1. 5 sdao 1 r/w sda output value control this bit is used with sdaop when modifying output level of sda. this bit should not be manipulated during transfer. 0: when reading, sda pin outputs low. when writing, sda pin is changed to output low. 1: when reading, sda pin outputs high. when writing, sda pin is changed to output hi-z (outputs high by external pull-up resistance).
section 16 i 2 c bus interface 2 (iic2) rev. 4.00 sep. 14, 2005 page 480 of 982 rej09b0023-0400 bit bit name initial value r/w description 4 sdaop 1 r/w sdao write protect this bit controls change of output level of the sda pin by modifying the sdao bit. to change the output level, clear sdao and sdaop to 0 or set sdao to 1 and clear sdaop to 0. this bit is always read as 1. 3 sclo 1 r this bit monitors sc l output level. when sclo is 1, scl pin outputs high. when sclo is 0, scl pin outputs low. 2 ? 1 ? reserved this bit is always read as 1, and cannot be modified. 1 iicrst 0 r/w iic control part reset this bit resets the control part except for i 2 c registers. if this bit is set to 1 when hang-up occurs because of communication failure during i 2 c operation, i 2 c control part can be reset without setting ports and initializing registers. 0 ? 1 ? reserved this bit is always read as 1, and cannot be modified. 16.3.3 i 2 c bus mode register (icmr) icmr is an 8-bit readable/writable register that selects whether the msb or lsb is transferred first, performs master mode wait control, and selects the transfer bit count. icmr is initialized to h ' 38 by a power-on reset. bit bit name initial value r/w description 7 mls 0 r/w msb-first/lsb-first select 0: msb-first 1: lsb-first set this bit to 0 when the i 2 c bus format is used. 6 ? 0 ? reserved the write value should always be 0.
section 16 i 2 c bus interface 2 (iic2) rev. 4.00 sep. 14, 2005 page 481 of 982 rej09b0023-0400 bit bit name initial value r/w description 5, 4 ? all 1 ? reserved these bits are always read as 1. 3 bcwp 1 r/w bc write protect this bit controls the bc2 to bc0 modifications. when modifying bc2 to bc0, this bit should be cleared to 0. in clock synchronous serial mode, bc should not be modified. 0: when writing, values of bc2 to bc0 are set. 1: when reading, 1 is always read. when writing, settings of bc2 to bc0 are invalid. bit counter 2 to 0 these bits specify the number of bits to be transferred next. when read, the remaining number of transfer bits is indicated. with the i 2 c bus format, the data is transferred with one addition acknowledge bit. should be made between transfer frames. if bits bc2 to bc0 are set to a value other than 000, the setting should be made while the scl pin is low. the value returns to 000 at the end of a data transfer, including the acknowledge bit. these bits are cleared by a power-on reset and in standby mode. these bits are also cleared by setting iicrst of iccr2 to 1. with the clock synchronous serial format, these bits should not be modified. 2 1 0 bc2 bc1 bc0 0 0 0 r/w r/w r/w i 2 c bus format 000: 9 bits 001: 2 bits 010: 3 bits 011: 4 bits 100: 5 bits 101: 6 bits 110: 7 bits 111: 8 bits clock synchronous serial format 000: 8 bits 001: 1 bit 010: 2 bits 011: 3 bits 100: 4 bits 101: 5 bits 110: 6 bits 111: 7 bits
section 16 i 2 c bus interface 2 (iic2) rev. 4.00 sep. 14, 2005 page 482 of 982 rej09b0023-0400 16.3.4 i 2 c bus interrupt enable register (icier) icier is an 8-bit readable/writable register that enables or disables interrupt sources and acknowledge bits, sets acknowledge bits to be transferred, and confirms acknowledge bits received. icier is initialized to h ' 00 by a power-on reset. bit bit name initial value r/w description 7 tie 0 r/w transmit interrupt enable when the tdre bit in icsr is set to 1, this bit enables or disables the transmit data empty interrupt (txi). 0: transmit data empty interrupt request (txi) is disabled. 1: transmit data empty interrupt request (txi) is enabled. 6 teie 0 r/w transmit end interrupt enable this bit enables or disables the transmit end interrupt (tei) at the rising of the ninth clock while the tdre bit in icsr is 1. tei can be canceled by clearing the tend bit or the teie bit to 0. 0: transmit end interrupt request (tei) is disabled. 1: transmit end interrupt request (tei) is enabled. 5 rie 0 r/w receive interrupt enable this bit enables or disables the receive data full interrupt request (rxi) when a receive data is transferred from icdrs to icdrr and the rdrf bit in icsr is set to 1. rxi can be canceled by clearing the rdrf or rie bit to 0. 0: receive data full interrupt request (rxi) are disabled. 1: receive data full interrupt request (rxi) are enabled. 4 nakie 0 r/w nack receive interrupt enable this bit enables or disables the nack detection interrupt request (naki) when the nackf or al/ove bit in icsr is set. naki can be canceled by clearing the nackf, al/ove, or nakie bit to 0. 0: nack receive interrupt request (naki) is disabled. 1: nack receive interrupt request (naki) is enabled.
section 16 i 2 c bus interface 2 (iic2) rev. 4.00 sep. 14, 2005 page 483 of 982 rej09b0023-0400 bit bit name initial value r/w description 3 stie 0 r/w stop condition detection interrupt enable this bit enables or disables the stop condition (stpi) when the stop bit in icsr is set . 0: stop condition detection interrupt request (stpi) is disabled. 1: stop condition detection interrupt request (stpi) is enabled. 2 acke 0 r/w acknowledge bit judgment select 0: the value of the receive acknowledge bit is ignored, and continuous transfer is performed. 1: if the receive acknowledge bit is 1, continuous transfer is halted. 1 ackbr 0 r receive acknowledge in transmit mode, this bit stores the acknowledge data that are returned by the receive device. this bit cannot be modified. this bit can be canceled by clearing the bbsy bit in iccr2 to 1. 0: receive acknowledge = 0 1: receive acknowledge = 1 0 ackbt 0 r/w transmit acknowledge in receive mode, this bit specifies the bit to be sent at the acknowledge timing. 0: 0 is sent at the acknowledge timing. 1: 1 is sent at the acknowledge timing.
section 16 i 2 c bus interface 2 (iic2) rev. 4.00 sep. 14, 2005 page 484 of 982 rej09b0023-0400 16.3.5 i 2 c bus status register (icsr) icsr is an 8-bit readable/writable register that confirms interrupt request flags and their status. icsr is initialized to h ' 00 by a power-on reset. bit bit name initial value r/w description 7 tdre 0 r/w transmit data register empty [setting conditions] ? when data is transferred from icdrt to icdrs and icdrt becomes empty ? when trs is set ? when the start condition (including retransmission) is issued ? when slave mode is changed from receive mode to transmit mode [clearing conditions] ? when 0 is written in tdre after reading tdre = 1 ? when data is written to icdrt 6 tend 0 r/w transmit end [setting conditions] ? when the ninth clock of scl rises with the i 2 c bus format while the tdre flag is 1 ? when the final bit of transmit frame is sent with the clock synchronous serial format [clearing conditions] ? when 0 is written in tend after reading tend = 1 ? when data is written to icdrt with an instruction 5 rdrf 0 r/w receive data register full [setting condition] ? when a receive data is transferred from icdrs to icdrr [clearing conditions] ? when 0 is written in rdrf after reading rdrf = 1 ? when icdrr is read with an instruction
section 16 i 2 c bus interface 2 (iic2) rev. 4.00 sep. 14, 2005 page 485 of 982 rej09b0023-0400 bit bit name initial value r/w description 4 nackf 0 r/w no acknowledge detection flag [setting condition] ? when no acknowledge is detected from the receive device in transmission while the acke bit in icier is 1 [clearing condition] ? when 0 is written in nackf after reading nackf = 1 3 stop 0 r/w stop condition detection flag [setting condition] ? when a stop condition is detected after frame transfer [clearing condition] ? when 0 is written in stop after reading stop = 1 2 al/ove 0 r/w arbitration lost flag/overrun error flag this flag indicates that arbitration was lost in master mode with the i 2 c bus format and that the final bit has been received while rdrf = 1 with the clocked synchronous format. when two or more master devices attempt to seize the bus at nearly the same time, if the i 2 c bus interface detects data differing from the data it sent, it sets al to 1 to indicate that the bus has been taken by another master. [setting conditions] ? if the internal sda and sda pin disagree at the rise of scl in master transmit mode ? when the sda pin outputs high in master mode while a start condition is detected ? when the final bit is received with the clocked synchronous format while rdrf = 1 [clearing condition] ? when 0 is written in al/ove after reading al/ove = 1
section 16 i 2 c bus interface 2 (iic2) rev. 4.00 sep. 14, 2005 page 486 of 982 rej09b0023-0400 bit bit name initial value r/w description 1 aas 0 r/w slave addr ess recognition flag in slave receive mode, this flag is set to 1 if the first frame following a start condition matches bits sva6 to sva0 in sar. [setting conditions] ? when the slave address is detected in slave receive mode ? when the general call address is detected in slave receive mode. [clearing condition] ? when 0 is written in aas after reading aas=1 0 adz 0 r/w general call address recognition flag this bit is valid in i 2 c bus format slave receive mode. [setting condition] ? when the general call address is detected in slave receive mode [clearing condition] ? when 0 is written in adz after reading adz=1 16.3.6 slave address register (sar) sar is an 8-bit readable/writable register that selects the communications format and sets the slave address. in slave mode with the i 2 c bus format, if the upper seven bits of sar match the upper seven bits of the first frame received after a start condition, this modul e operates as the slave device. sar is initialized to h ' 00 by a power-on reset. bit bit name initial value r/w description 7 to 1 sva6 to sva0 all 0 r/w slave address 6 to 0 these bits set a unique address in bits sva6 to sva0, differing form the addresses of other slave devices connected to the i 2 c bus. 0 fs 0 r/w format select 0: i 2 c bus format is selected 1: clocked synchronous se rial format is selected
section 16 i 2 c bus interface 2 (iic2) rev. 4.00 sep. 14, 2005 page 487 of 982 rej09b0023-0400 16.3.7 i 2 c bus transmit data register (icdrt) icdrt is an 8-bit readable/writable register that stores the transmit data. when icdrt detects the space in the shift register (icdrs), it transfers th e transmit data which is written in icdrt to icdrs and starts transferring data. if the next transfer data is written to icdrt during transferring data of icdrs, continuous transfer is possible. 16.3.8 i 2 c bus receive data register (icdrr) icdrr is an 8-bit register that stores the receiv e data. when data of one byte is received, icdrr transfers the receive data from icdrs to icdrr and the next data can be received. icdrr is a receive-only register, therefore the cp u cannot write to this register. 16.3.9 i 2 c bus shift register (icdrs) icdrs is a register that is used to transfer/receive data. in transm ission, data is transferred from icdrt to icdrs and the data is sent from the sda pin. in reception, data is transferred from icdrs to icdrr after data of one byte is received. this register cannot be read directly from the cpu. 16.3.10 nf2cyc register (nf2cyc) nf2cyc is an 8-bit readable/writable register that selects the range of the noise filtering for the scl and sda pins. for details of the noise filter, see section 16.4.7, noise filter. nf2cyc is initialized to h ' 00 by a power-on reset. bit bit name initial value r/w description 7 to 1 ? all 0 r reserved these bits are always read as 0. 0 nf2cyc 0 r/w noise filtering range select 0: the noise less than one cycle of the peripheral clock can be filtered out 1: the noise less than two cycles of the peripheral clock can be filtered out
section 16 i 2 c bus interface 2 (iic2) rev. 4.00 sep. 14, 2005 page 488 of 982 rej09b0023-0400 16.4 operation the i 2 c bus interface can communicate either in i 2 c bus mode or clocked synchronous serial mode by setting fs in sar. 16.4.1 i 2 c bus format figure 16.3 shows the i 2 c bus formats. figure 16.4 shows the i 2 c bus timing. the first frame following a start condition always consists of eight bits. s sla r/ w a data a a/a p 1111 n 7 1 m (a) i 2 c bus format (fs = 0) (b) i 2 c bus format (start condition retransmission, fs = 0) n: transfer bit count (n = 1 to 8) m: transfer frame count (m 1) s sla r/ w a data 11 1n 1 7 1 m1 s sla r/ w a data a/ a p 111n2 7 1 m2 11 1 a/a n1 and n2: transfer bit count (n1 and n2 = 1 to 8) m1 and m2: transfer frame count (m1 and m2 1) 11 figure 16.3 i 2 c bus formats sda scl s 1-7 sla 8 r/w 9 a 1-7 data 89 1-7 89 a data p a figure 16.4 i 2 c bus timing
section 16 i 2 c bus interface 2 (iic2) rev. 4.00 sep. 14, 2005 page 489 of 982 rej09b0023-0400 [legend] s: start condition. the master device driv es sda from high to low while scl is high. sla: slave address r/w: indicates the direction of data transfer: from the slave device to the master device when r/w is 1, or from the master device to the slave device when r/w is 0. a: acknowledge. the receive device drives sda to low. data: transfer data p: stop condition. the master device drives sda from low to high while scl is high. 16.4.2 master transmit operation in master transmit mode, the master device outputs the transmit clock and transmit data, and the slave device returns an acknowledge signal. for ma ster transmit mode operation timing, refer to figures 16.5 and 16.6. the transmission procedure and operations in master transmit mode are described below. 1. set the ice bit in iccr1 to 1. set bits cks3 to cks0 in iccr1 to 1. (initial setting) 2. read the bbsy flag in iccr2 to confirm that the bus is free. set the mst and trs bits in iccr1 to select master transmit mode. then, write 1 to bbsy and 0 to scp. (start condition issued) this generates the start condition. 3. after confirming that tdre in icsr has been set, write the transmit data (the first byte data show the slave address and r/ w ) to icdrt. at this time, tdre is automatically cleared to 0, and data is transferred from icdrt to icdrs. tdre is set again. 4. when transmission of one byte data is completed while tdre is 1, tend in icsr is set to 1 at the rise of the ninth transmit clock pulse. read the ackbr bit in icier, and confirm that the slave device has been selected. then, write second byte data to icdrt. when ackbr is 1, the slave device has not been acknowledged, so issue the stop condition. to issue the stop condition, write 0 to bbsy and scp. scl is fixed low until the transmit data is prepared or the stop condition is issued. 5. the transmit data after the second byte is written to icdrt every time tdre is set. 6. write the number of bytes to be transmitted to icdrt. wait until tend is set (the end of last byte data transmission) while tdre is 1, or wait for nack (nackf in icsr = 1) from the receive device while acke in icier is 1. then , issue the stop condition to clear tend or nackf. 7. when the stop bit in icsr is set to 1, the operation returns to the slave receive mode.
section 16 i 2 c bus interface 2 (iic2) rev. 4.00 sep. 14, 2005 page 490 of 982 rej09b0023-0400 tdre scl (master output) sda (master output) sda (slave output) tend [5] write data to icdrt (third byte) icdrt icdrs [2] instruction of start condition issuance [3] write data to icdrt (first byte) [4] write data to icdrt (second byte) user processing 1 bit 7 slave address address + r/w data 1 data 1 data 2 address + r/w bit 6 bit 7 bit 6 bit 5bit 4bit 3bit 2bit 1bit 0 21 2 3456789 a r/w figure 16.5 master transmit mode operation timing (1) tdre [6] issue stop condition. clear tend. [7] set slave receive mode tend icdrt icdrs 1 9 23456789 a a/a scl (master output) sda (master output) sda (slave output) bit 7 bit 6 data n data n bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 [5] write data to icdrt user processing figure 16.6 master transmit mode operation timing (2)
section 16 i 2 c bus interface 2 (iic2) rev. 4.00 sep. 14, 2005 page 491 of 982 rej09b0023-0400 16.4.3 master receive operation in master receive mode, the master device outputs th e receive clock, receives data from the slave device, and returns an acknowledge signal. for master receive mode operation timing, refer to figures 16.7 and 16.8. the reception procedure and operations in master receive mode are shown below. 1. clear the tend bit in icsr to 0, then clear the trs bit in iccr1 to 0 to switch from master transmit mode to master receive mode . then, clear the tdre bit to 0. 2. when icdrr is read (dummy data read), reception is started, and the receive clock is output, and data received, in synchronization with the internal clock. the master device outputs the level specified by ackbt in icier to sda, at the ninth receive clock pulse. 3. after the reception of first frame data is complete d, the rdrf bit in icst is set to 1 at the rise of ninth receive clock pulse. at this time, th e receive data is read by reading icdrr, and rdrf is cleared to 0. 4. the continuous reception is performed by reading icdrr every time rdrf is set. if eighth receive clock pulse falls after reading icdrr by the other processing while rdrf is 1, scl is fixed low until icdrr is read. 5. if next frame is the last receive data, set th e rcvd bit in iccr1 to 1 before reading icdrr. this enables the issuance of the stop condition after the next reception. 6. when the rdrf bit is set to 1 at rise of the ninth receive clock pulse, issue the stage condition. 7. when the stop bit in icsr is set to 1, read icdrr. then clear the rcvd bit to 0. 8. the operation returns to the slave receive mode. note: set the rcvd bit in iccr1 to dummy-read icdrr to receive only one byte.
section 16 i 2 c bus interface 2 (iic2) rev. 4.00 sep. 14, 2005 page 492 of 982 rej09b0023-0400 tdre tend icdrs icdrr [1] clear tdre after clearing tend and trs [2] read icdrr (dummy read) [3] read icdrr 1 a 21 3456789 9 a trs rdrf scl (master output) sda (master output) sda (slave output) bit 7 master transmit mode master receive mode bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 user processing data 1 data 1 figure 16.7 master receive mode operation timing (1)
section 16 i 2 c bus interface 2 (iic2) rev. 4.00 sep. 14, 2005 page 493 of 982 rej09b0023-0400 rdrf rcvd icdrs icdrr data n-1 data n data n data n-1 [5] read icdrr after setting rcvd [6] issue stop condition [7] read icdrr, and clear rcvd [8] set slave receive mode 1 9 23456789 aa / a scl (master output) sda (master output) sda (slave output) bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 user processing figure 16.8 master receive mode operation timing (2) 16.4.4 slave transmit operation in slave transmit mode, the slave device outputs th e transmit data, while the master device outputs the receive clock and returns an acknowledge signal. for slave transmit mode operation timing, refer to figures 16.9 and 16.10. the transmission procedure and operations in slave transmit mode are described below. 1. set the ice bit in iccr1 to 1. set bits cks3 to cks0 in iccr1 to 1. (initial setting) set the mst and trs bits in iccr1 to select slave receive mode, and wait until the slave address matches. 2. when the slave address matches in the first frame following detection of the start condition, the slave device outputs the leve l specified by ackbt in icier to sda, at the rise of the ninth clock pulse. at this time, if the eighth bit data (r/ w ) is 1, the trs and icsr bits in iccr1 are set to 1, and the mode changes to slave transmit mode automatically. the continuous transmission is performed by writing transmit data to icdrt every time tdre is set. 3. if tdre is set after writing la st transmit data to icdrt, wait until tend in icsr is set to 1, with tdre = 1. when te nd is set, clear tend. 4. clear trs for the end processing, and read icdrr (dummy read). scl is free.
section 16 i 2 c bus interface 2 (iic2) rev. 4.00 sep. 14, 2005 page 494 of 982 rej09b0023-0400 5. clear tdre. tdre tend icdrs icdrr 1 a 21 3456789 9 a trs icdrt scl (master output) slave receive mode slave transmit mode sda (master output) sda (slave output) scl (slave output) bit 7 bit 7 data 1 data 1 data 2 data 3 data 2 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 [2] write data to icdrt (data 1) [2] write data to icdrt (data 2) [2] write data to icdrt (data 3) user processing figure 16.9 slave transmit mode operation timing (1)
section 16 i 2 c bus interface 2 (iic2) rev. 4.00 sep. 14, 2005 page 495 of 982 rej09b0023-0400 tdre data n tend icdrs icdrr 1 9 23456789 trs icdrt a scl (master output) sda (master output) sda (slave output) scl (slave output) bit 7 slave transmit mode slave receive mode bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 a [3] clear tend [5] clear tdre [4] read icdrr (dummy read) after clearing trs user processing figure 16.10 slave transmit mode operation timing (2)
section 16 i 2 c bus interface 2 (iic2) rev. 4.00 sep. 14, 2005 page 496 of 982 rej09b0023-0400 16.4.5 slave receive operation in slave receive mode, the master device outputs the transmit clock and transmit data, and the slave device returns an acknowledge signal. for slave receive mode operation timing, refer to figures 16.11 and 16.12. the reception procedure and operations in slave receive mode are described below. 1. set the ice bit in iccr1 to 1. set the mls and wait bits in icmr and bits cks3 to cks0 in iccr1 to 1. (initial setting) set the mst an d trs bits in iccr1 to select slave receive mode, and wait until the slave address matches. 2. when the slave address matches in the first frame following detection of the start condition, the slave device outputs the level specified by ackbt in icier to sda, at the rise of the ninth clock pulse. at the same time, rdrf in icsr is set to read icdrr (dummy read). (since the read data show the slave address and r/ w , it is not used.) 3. read icdrr every time rdrf is set. if eighth receive clock pulse falls while rdrf is 1, scl is fixed low until icdrr is read. the change of the acknowledge before reading icdrr, to be returned to the master device, is reflected to the next transmit frame. 4. the last byte data is read by reading icdrr. icdrs icdrr 12 1 345678 9 9 a a rdrf data 1 data 2 data 1 scl (master output) sda (master output) sda (slave output) scl (slave output) bit 7 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 [2] read icdrr (dummy read) [2] read icdrr user processing figure 16.11 slave receive mode operation timing (1)
section 16 i 2 c bus interface 2 (iic2) rev. 4.00 sep. 14, 2005 page 497 of 982 rej09b0023-0400 icdrs icdrr 12345678 9 9 a a rdrf scl (master output) sda (master output) sda (slave output) scl (slave output) user processing bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 data 1 [3] set ackbt [3] read icdrr [4] read icdrr data 2 data 1 figure 16.12 slave receive mode operation timing (2) 16.4.6 clocked synchronous serial format this module can be operated with the clocked synchronous serial format, by setting the fs bit in sar to 1. when the mst bit in iccr1 is 1, the transfer clock output from scl is selected. when mst is 0, the external clock input is selected. data transfer format: figure 16.13 shows the clocked synchronous serial transfer format. the transfer data is output from the rise to the fa ll of the scl clock, and the data at the rising edge of the scl clock is guaranteed. the mls bit in icmr sets the order of data transfer, in either the msb first or lsb first. the output level of sda can be changed during the transfer wait, by the sdao bit in iccr2. sda bit 0 bit 1 bit 2 bit 3 bit 4 bit 5 bit 6 bit 7 scl figure 16.13 clocked synchronous serial transfer format
section 16 i 2 c bus interface 2 (iic2) rev. 4.00 sep. 14, 2005 page 498 of 982 rej09b0023-0400 transmit operation: in transmit mode, transmit data is output from sda, in synchronization with the fall of the transfer clock. the transfer clock is output when mst in iccr1 is 1, and is input when mst is 0. for transmit mode operation timing, refer to figure 16.14. the transmission procedure and operations in transmit mode are described below. 1. set the ice bit in iccr1 to 1. set the mst and cks3 to cks0 bits in iccr1 to 1. (initial setting) 2. set the trs bit in iccr1 to select the transmit mode. then, tdre in icsr is set. 3. confirm that tdre has been set. then, write the transmit data to icdrt. the data is transferred from icdrt to icdrs, and td re is set automatically. the continuous transmission is performed by writing data to icdrt every time tdre is set. when changing from transmit mode to receive mode, clear trs while tdre is 1. 12 781 78 1 scl trs bit 0 data 1 data 1 data 2 data 3 data 2 data 3 bit 6 bit 7 bit 0 bit 6 bit 7 bit 0 bit 1 sda (output) tdre icdrt icdrs user processing [3] write data to icdrt [3] write data to icdrt [3] write data to icdrt [3] write data to icdrt [2] set trs figure 16.14 transmit mode operation timing
section 16 i 2 c bus interface 2 (iic2) rev. 4.00 sep. 14, 2005 page 499 of 982 rej09b0023-0400 receive operation: in receive mode, data is latched at the rise of the transfer clock. the transfer clock is output when mst in iccr1 is 1, and is input when mst is 0. for receive mode operation timing, refer to figure 16.15. the reception pro cedure and operations in receiv e mode are described below. 1. set the ice bit in iccr1 to 1. set the mst and cks3 to cks0 bits in iccr1 to 1. (initial setting) 2. when the transfer clock is output, set mst to 1 to start outputting the receive clock. 3. when the receive operation is completed, da ta is transferred from icdrs to icdrr and rdrf in icsr is set. when mst = 1, the ne xt byte can be received, so the clock is continually output. the continuous reception is performed by reading icdrr every time rdrf is set. when the eighth clock is raised while rdrf is 1, the overrun is detected and al/ove in icsr is set. at this time, the pr evious reception data is retained in icdrr. 4. to stop receiving when mst = 1, set rcvd in iccr1 to 1, then read icdrr. then, scl is fixed high after receiving the next byte data. notes: follow the steps below to receive only one byte with mst=1 specified. see figure 16.16 for the operation timing. 1. set the ice bit in iccr1 to 1. set bits cks3 to cks0 in iccr1. (initial setting) 2. set mst=1 while the rcvd bit in iccr1 is 0. this cau ses the receive clock to be output. 3. check if the bc2 bit in icmr is set to 1 and then set the rcvd bit in iccr1 to 1. this causes the scl to be fixed to the high level after outputting one byte of the receive clock.
section 16 i 2 c bus interface 2 (iic2) rev. 4.00 sep. 14, 2005 page 500 of 982 rej09b0023-0400 12 781 7812 scl mst trs rdrf icdrs icdrr sda (input) bit 0 bit 6 bit 7 bit 0 bit 6 bit 7 bit 0 bit 1 bit 1 user processing data 1 data 1 data 2 data 2 data 3 [2] set mst (when outputting the clock) [3] read icdrr [3] read icdrr figure 16.15 receive mode operation timing sda (input) bit 0 12345678 000 bit 1 bit 2 bit 3 bit 4 bit 5 bit 6 bit 7 scl mst rcvd bc2 to bc0 [2] set mst 111 110 101 100 011 010 001 000 [3] set the rcvd bit after checking if bsc2 = 1 figure 16.16 operation timing for receiving one byte
section 16 i 2 c bus interface 2 (iic2) rev. 4.00 sep. 14, 2005 page 501 of 982 rej09b0023-0400 16.4.7 noise filter the logic levels at the scl and sda pins are routed through noise filters before being latched internally. figure 16.17 shows a block diagram of the noise filter circuit. the noise filter consists of three cascaded latches and a match detector. the scl (or sda) input signal is sampled on the system clock. when nf2cyc is set to 0, this signal is not passed forward to the next circuit unless the outputs of both latches agree. when nf2cyc is set to 1, this signal is not passed forward to the next circuit unless the outputs of three latches agree. if they do not agree, the previous value is held. scl or sda input signal internal scl or sda signal sampling clock sampling clock peripheral clock cycle c latch q d c latch q d match detector c latch q d match detector nf2cvc 1 0 figure 16.17 block diagram of noise filter
section 16 i 2 c bus interface 2 (iic2) rev. 4.00 sep. 14, 2005 page 502 of 982 rej09b0023-0400 16.4.8 example of use flowcharts in respective modes that use the i 2 c bus interface are shown in figures 16.18 to 16.21. bbsy=0 ? no tend=1 ? no yes start [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [13] [14] [15] initialize set mst and trs in iccr1 to 1 write 1 to bbsy and 0 to scp write transmit data in icdrt write 0 to bbsy and scp set mst to 1 and trs to 0 in iccr1 read bbsy in iccr2 read tend in icsr read ackbr in icier mater receive mode yes ackbr=0 ? write transmit data in icdrt read tdre in icsr read tend in icsr clear tend in icsr read stop in icsr clear tdre in icsr end write transmit data in icdrt transmit mode? no yes tdre=1 ? last byte? stop=1 ? no no no no no yes yes tend=1 ? yes yes yes [1] test the status of the scl and sda lines. [2] set master transmit mode. [3] issue the start candition. [4] set the first byte (slave address + r/ w) of transmit data. [5] wait for 1 byte to be transmitted. [6] test the acknowledge transferred from the specified slave device. [7] set the second and subsequent bytes (except for the final byte) of transmit data. [8] wait for icdrt empty. [9] set the last byte of transmit data. [10] wait for last byte to be transmitted. [11] clear the tend flag. [12] clear the stop flag. [13] issue the stop condition. [14] wait for the creation of stop condition. [15] set slave receive mode. clear tdre. [12] clear stop in icsr figure 16.18 sample flowch art for master transmit mode
section 16 i 2 c bus interface 2 (iic2) rev. 4.00 sep. 14, 2005 page 503 of 982 rej09b0023-0400 no yes rdrf=1 ? no yes rdrf=1 ? last receive - 1? mater receive mode clear tend in icsr clear trs in iccr1 to 0 clear tdre in icsr clear ackbt in icier to 0 dummy-read icdrr read rdrf in icsr read icdrr set ackbt in icier to 1 set rcvd in iccr1 to 1 read icdrr read rdrf in icsr write 0 to bbsy and scp read stop in icsr read icdrr clear rcvd in iccr1 to 0 clear mst in iccr1 to 0 end no yes stop=1 ? no yes [1] clear tend, select master receive mode, and then clear tdre. [2] set acknowledge to the transmit device. [3] dummy-read icddr. [4] wait for 1 byte to be received [5] check whether it is the (last receive - 1). [6] read the receive data last. [7] set acknowledge of the final byte. disable continuous reception (rcvd = 1). [8] read the (final byte - 1) of received data. [9] wait for the last byte to be receive. [10] clear the stop flag. [11] issue the stop condition. [12] wait for the creation of stop condition. [13] read the last byte of receive data. [14] clear rcvd. [15] set slave receive mode. [1] [2] [3] [4] [5] [6] clear stop in icsr [10] [7] [8] [9] [11] [12] [13] [14] [15] note: when the size of receive data is only one byte in reception, steps [2] to [6] are skipped after step [1], before jumping to step [7]. the step [8] is dummy-read in icdrr. however, when the size of receive data is two bytes and more, steps [2] to [6] are not skipped after step [1]. figure 16.19 sample flowch art for master receive mode
section 16 i 2 c bus interface 2 (iic2) rev. 4.00 sep. 14, 2005 page 504 of 982 rej09b0023-0400 tdre=1 ? yes yes no slave transmit mode clear aas in icsr write transmit data in icdrt read tdre in icsr last byte? write transmit data in icdrt read tend in icsr clear tend in icsr set trs in iccr1 to 0 dummy-read icdrr clear tdre in icsr end [1] clear the aas flag. [2] set transmit data for icdrt (except for the last byte). [3] wait for icdrt empty. [4] set the last byte of transmit data. [5] wait for the last byte to be transmitted. [6] clear the tend flag . [7] set slave receive mode. [8] dummy-read icdrr to release the scl line. [9] clear the tdre flag. no no yes tend=1 ? [1] [2] [3] [4] [5] [6] [7] [8] [9] figure 16.20 sample flowchart for slave transmit mode
section 16 i 2 c bus interface 2 (iic2) rev. 4.00 sep. 14, 2005 page 505 of 982 rej09b0023-0400 no yes rdrf=1 ? no yes rdrf=1 ? last receive - 1? slave receive mode clear aas in icsr clear ackbt in icier to 0 dummy-read icdrr read rdrf in icsr read icdrr set ackbt in icier to 1 read icdrr read rdrf in icsr read icdrr end no yes [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [1] clear the aas flag. [2] set acknowledge to the transmit device. [3] dummy-read icdrr. [4] wait for 1 byte to be received. [5] check whether it is the (last receive - 1). [6] read the receive data. [7] set acknowledge of the last byte. [8] read the (last byte - 1) of receive data. [9] wait the last byte to be received. [10] read for the last byte of receive data. note: when the size of receive data is only one byte in reception, steps [2] to [6] are skipped after step [1], before jumping to step [7]. the step [8] is dummy-read in icdrr. however, when the size of receive data is two bytes and more, steps [2] to [6] are not skipped after step [1]. figure 16.21 sample flowch art for slave receive mode
section 16 i 2 c bus interface 2 (iic2) rev. 4.00 sep. 14, 2005 page 506 of 982 rej09b0023-0400 16.5 interrupt request there are six interrupt requ ests in this module; transmit data em pty, transmit end, receive data full, nack receive, stop recogn ition, and arbitration lost/overrun error. table 16.3 shows the contents of each interrupt request. table 16.3 interrupt requests interrupt request abbreviation interrupt condition i 2 c mode clocked synchronous mode transmit data empty txi (tdre=1) ? (tie=1) { { transmit end tei (tend=1) ? (teie=1) { { receive data full rxi (rdrf=1) ? (rie=1) { { stop recognition stpi (stop=1) ? (stie=1) { nack receive { arbitration lost/ overrun error naki {(nackf=1)+(al=1)} ? (nakie=1) { { when the interrupt condition described in table 16.3 is 1, the cpu executes an interrupt exception handling. interrupt sources should be cleared in the exception handling. the tdre and tend bits are automatically cleared to 0 by writing th e transmit data to icdrt. the rdrf bit is automatically cleared to 0 by reading icdrr. the tdre bit is set to 1 again at the same time when the transmit data is written to icdrt. when th e tdre bit is cleared to 0, then an excessive data of one byte may be transmitted.
section 16 i 2 c bus interface 2 (iic2) rev. 4.00 sep. 14, 2005 page 507 of 982 rej09b0023-0400 16.6 bit synchronous circuit in master mode, this module has a possibility that high level period may be short in the two states described below. ? when scl is driven to low by the slave device ? when the rising speed of scl is lowered by the load of the scl line (load capacitance or pull- up resistance) therefore, it monitors scl and communicates by bit with synchronization. figure 16.22 shows the timing of the bit synchronous circuit and table 16.4 shows the time when scl output changes from low to hi-z then scl is monitored. scl v ih scl monitor timing reference clock internal scl figure 16.22 the timing of the bit synchronous circuit table 16.4 time for monitoring scl cks3 cks2 cks2cyc time for monitoring scl 0 6.5 pcyc 0 1 5.5 pcyc 0 18.5 pcyc 0 1 1 17.5 pcyc 0 16.5 pcyc 0 1 15.5 pcyc 0 40.5 pcyc 1 1 1 39.5 pcyc note: the pcyc indicates t he peripheral clock cycle.
section 16 i 2 c bus interface 2 (iic2) rev. 4.00 sep. 14, 2005 page 508 of 982 rej09b0023-0400 16.7 usage note start (retransmission) and stop conditions should be generated after the fall of the ninth clock pulse has been detected. to detect the fall of the ninth clock pulse, read the sclo bit in the i 2 c bus control register 2 (iccr2). when the start (retransmission) or stop condition is attempt to be generated at the specific timing under the following two conditions, the start or stop condition may not be generated normally. under conditions other than following two, generation is performed normally. ? when the load of the scl bus (load capacitance or pull-up resistance) makes the rising speed of scl slower than speeds shown in section 16.6, bit synchronous circuit ? when the low level period between the eighth and ninth clock pulses is extended and bit synchronous circuit starts operation
section 17 compare match timer (cmt) rev. 4.00 sep. 14, 2005 page 509 of 982 rej09b0023-0400 section 17 compare match timer (cmt) this lsi has an on-chip compare match timer (cmt) consisting of a two-channel 16-bit timer. the cmt has a16-bit counter, and can generate interrupts at set intervals. 17.1 features cmt has the following features. ? selection of four counter input clocks ? any of four internal clocks (p /4, p /8, p /16, and p /64) can be selected independently for each channel. ? selection of dma transfer request or interrupt request generation on compare match ? when not in use, cmt can be stopped by halting its clock supply to reduce power consumption. figure 17.1 shows a block diagram of cmt. control circuit clock selection cmstr_0 cmcsr_0 cmcor_0 cmcnt_0 channel 0 channel 1 cmt p/4 cmstr_1 cmcsr_1 cmcor_1 cmcnt_1 p/8 p /16 p/64 p/4 p/8 p /16 p/64 clock selection control circuit comparator comparator cmstr: cmcsr: cmcor: cmcnt: compare match timer start register compare match timer control/status register compare match timer constant register compare match counter [legend] module bus bus interface internal bus figure 17.1 block diagram of compare match timer
section 17 compare match timer (cmt) rev. 4.00 sep. 14, 2005 page 510 of 982 rej09b0023-0400 17.2 register descriptions the cmt has the following registers. refer the section 24, list of registers and access size for these registers. ? compare match timer star t register_0 (cmstr_0) ? compare match timer control/status register_0 (cmcsr_0) ? compare match counter_0 (cmcnt_0) ? compare match timer constant register_0 (cmcor_0) ? compare match timer star t register_1 (cmstr_1) ? compare match timer control/status register_1 (cmcsr_1) ? compare match counter_1 (cmcnt_1) ? compare match timer constant register_1 (cmcor_1) 17.2.1 compare match tim er start register (cmstr) cmstr is a 16-bit register that selects whether compare match counter (cmcnt) operates or is stopped. cmstr is initialized to h'0000 by a power on reset, but is not initialized in standby mode. bit bit name initial value r/w description 15 to 1 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 0 str 0 r/w count start specifies whether compare ma tch counter operates or is stopped. 0: cmcnt count is stopped 1: cmcnt count is started
section 17 compare match timer (cmt) rev. 4.00 sep. 14, 2005 page 511 of 982 rej09b0023-0400 17.2.2 compare match timer co ntrol/status register (cmcsr) cmcsr is a 16-bit register that indicates comp are match generation, enables interrupts or dma transfer requests, and select s the counter input clock. cmcsr is initialized to h'0000 by a power on reset, but is not initialized in standby mode. bit bit name initial value r/w description 15 to 8 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 7 cmf 0 r/(w) * compare match flag indicates whether or not the values of cmcnt and cmcor match. 0: cmcnt and cmcor values do not match [clearing condition] when 0 is written to cmf after reading cmf = 1 1: cmcnt and cmcor values match 6 ? 0 r reserved this bit is always read as 0. the write value should always be 0. 5 4 cmr1 cmr0 0 0 r/w r/w compare match request these bits enable or disable dma transfer request or interrupt request generation when a compare match occurs. 00: dma transfer request/interrupt request disabled 01: dma transfer request enabled 10: interrupt request enabled 11: reserved (setting prohibited) 3, 2 ? all 0 r reserved these bits are always read as 0. the write value should always be 0.
section 17 compare match timer (cmt) rev. 4.00 sep. 14, 2005 page 512 of 982 rej09b0023-0400 bit bit name initial value r/w description 1 0 cks1 cks0 0 0 r/w r/w clock select these bits select the clock to be input to cmcnt from four internal clocks obtained by dividing the peripheral operating clock (p ). when the str bit in cmstr is set to 1, cmcnt starts counting on the clock selected with bits cks1 and cks0. 00: p /4 01: p /8 10: p /16 11: p /64 note: * only 0 can be written, to clear the flag. 17.2.3 compare match counter (cmcnt ) cmcnt is a 16-bit register used as an up-counter. when the counter input clock is selected with bits cks1 and cks0 in cmcsr, and the str bit in cmstr is set to 1, cmcnt starts counting using the selected clock. when the value in cmcnt and the value in comp are match constant register (cmcor) match, cmcnt is cleared to h'0000 and the cmf flag in cmcsr is set to 1. cmcnt is initialized to h'0000 by a power on reset, but is not initialized in standby mode. 17.2.4 compare match co nstant register (cmcor) cmcor is a 16-bit register that sets the interval up to a compare match with cmcnt. cmcor is initialized to h'ffff by a power on reset, but is not initialized in standby mode.
section 17 compare match timer (cmt) rev. 4.00 sep. 14, 2005 page 513 of 982 rej09b0023-0400 17.3 operation 17.3.1 interval count operation when an internal clock is selected with the ck s1 and cks0 bits in cmcsr and the str bit in cmstr is set to 1, cmcnt starts incrementing us ing the selected clock. when the values in cmcnt and cmcor match, cmcnt is cleared to h'0000 and the cmf flag in cmcsr is set to 1. cmcnt then starts counting up again from h'0000. figure 17.2 shows the operatio n of the compare match counter. cmcor h'0000 cmcnt value time counter cleared by compare match with cmcor figure 17.2 counter operation 17.3.2 cmcnt count timing one of four internal clocks (p /4, p /8, p /16, and p /64) obtained by dividing the p clock can be selected with bits cks1 and cks0 in cmcsr. figure 17.3 shows the timing. peripheral operating clock (p) clock n clock n + 1 internal clock count clock cmcnt n n + 1 figure 17.3 count timing
section 17 compare match timer (cmt) rev. 4.00 sep. 14, 2005 page 514 of 982 rej09b0023-0400 17.4 compare matches 17.4.1 timing of compare match flag setting when cmcor and cmcnt match, a compare match signal is generated and the cmf bit in cmcsr is set to 1. the compare match signal is ge nerated in the last state in which the values match (when the cmcnt value is updated to h'0000). that is, after a match between cmcor and cmcnt, the compare match signal is not generated until the next cmcnt counter clock input. figure 17.4 shows the timing of cmf bit setting. n peripheral operating clock (p) counter clock cmcnt cmcor compare match signal clock n + 1 n 0 figure 17.4 timing of cmf setting 17.4.2 dma transfer reques ts and interrupt requests generation of a dma transfer request or an interrupt request when a compare match occurs can be selected with bits cmr1 and cmr0 in cmcsr. with a dma transfer request, th e request signal is cleared auto matically when the dmac accepts the request. however, the cmf bit in cmcsr is not cleared to 0. an interrupt request is cleared by writing 0 to th e cmf bit in cmcsr. therefore, an operation to set cmf = 0 must be performed by the user in the exception handling routine. if this operation is not carried out, another interrupt will be generated.
section 17 compare match timer (cmt) rev. 4.00 sep. 14, 2005 page 515 of 982 rej09b0023-0400 17.4.3 timing of compare match flag clearing the cmf bit in cmcsr is cleared by firs t, reading as 1 then writing to 0.
section 17 compare match timer (cmt) rev. 4.00 sep. 14, 2005 page 516 of 982 rej09b0023-0400
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 517 of 982 rej09b0023-0400 section 18 multi-functio n timer pulse unit (mtu) this lsi has an on-chip multi-function timer pulse unit (mtu) that comprises five 16-bit timer channels. the block diagram is shown in figure 18.1. 18.1 features ? maximum 16-pulse input/output ? selection of 8 counter input clocks for each channel ? the following operations can be set for each channel: ? waveform output at compare match ? input capture function ? counter clear operation multiple timer counters (tcnt) can be written to simultaneously simultaneous clearing by compare match and input capture is possible register simultaneous input/output is possible by synchronous counter operation ? a maximum 12-phase pwm output is possible in combination with synchronous operation ? buffer operation settable for channels 0, 3, and 4 ? phase counting mode settable independently for each of channels 1 and 2 ? cascade connection operation ? fast access via internal 16-bit bus ? 23 interrupt sources ? automatic transfer of register data ? a/d converter conversion start trigger can be generated ? module standby mode can be set
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 518 of 982 rej09b0023-0400 table 18.1 mtu functions item channel 0 channel 1 ch annel 2 channel 3 channel 4 count clock /1 /4 /16 /64 tclka tclkb tclkc tclkd /1 /4 /16 /64 /256 tclka tclkb /1 /4 /16 /64 /1024 tclka tclkb tclkc /1 /4 /16 /64 /256 /1024 tclka tclkb /1 /4 /16 /64 /256 /1024 tclka tclkb general registers tgra_0 tgrb_0 tgra_1 tgrb_1 tgra_2 tgrb_2 tgra_3 tgrb_3 tgra_4 tgrb_4 general registers/ buffer registers tgrc_0 tgrd_0 ? ? tgrc_3 tgrd_3 tgrc_4 tgrd_4 i/o pins tioc0a tioc0b tioc0c tioc0d tioc1a tioc1b tioc2a tioc2b tioc3a tioc3b tioc3c tioc3d tioc4a tioc4b tioc4c tioc4d counter clear function tgr compare match or input capture tgr compare match or input capture tgr compare match or input capture tgr compare match or input capture tgr compare match or input capture 0 output o o o o o 1 output o o o o o compare match output toggle output o o o o o input capture function o o o o o synchronous operation o o o o o pwm mode 1 o o o o o pwm mode 2 o o o ? ? phase counting mode ? o o ? ? buffer operation o ? ? o o
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 519 of 982 rej09b0023-0400 item channel 0 channel 1 ch annel 2 channel 3 channel 4 dma activation tgra_0 compare match or input capture tgra_1 compare match or input capture tgra_2 compare match or input capture tgra_3 compare match or input capture tgra_4 compare match or input capture a/d converter start trigger tgra_0 compare match or input capture tgra_1 compare match or input capture tgra_2 compare match or input capture tgra_3 compare match or input capture tgra_4 compare match or input capture interrupt sources 5 sources ? compare match or input capture 0a ? compare match or input capture 0b ? compare match or input capture 0c ? compare match or input capture 0d ? overflow 4 sources ? compare match or input capture 1a ? compare match or input capture 1b ? overflow ? underflow 4 sources ? compare match or input capture 2a ? compare match or input capture 2b ? overflow ? underflow 5 sources ? compare match or input capture 3a ? compare match or input capture 3b ? compare match or input capture 3c ? compare match or input capture 3d ? overflow 5 sources ? compare match or input capture 4a ? compare match or input capture 4b ? compare match or input capture 4c ? compare match or input capture 4d ? overflow [legend] o : possible ? : not possible
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 520 of 982 rej09b0023-0400 internal data bus a/d converter conversion start signal tcnt tgra tgrb tgrc tgrd tcr tiorh tier tmdr tiorl tsr channel 3 tcnt tgra tgrb tgrc tgrd tmdr tiorl tsr tcr tiorh tier channel 4 tcnts tcdr tcbr tddr toer tocr tgcr bus i/f common tcnt tgra tgrb tmdr tsr tcr tior tier tsyr tstr channel 2 tcnt tgra tgrb tmdr tsr tcr tior tier channel 1 tcnt tgra tgrb tgrc tgrd tmdr tiorl tsr tcr tiorh tier channel 0 control logic module data bus control logic for channels 0 to 2 control logic for channels 3 and 4 [legend] tstr: tsyr: tcr: tmdr: tior (h, l): timer start register timer synchro register timer control register timer mode register timer i/o control registers (h, l) tier: tsr: tcnt: tgr (a, b, c, d): timer interrupt enable register timer status register timer counter timer general registers (a, b, c, d) interrupt request signals channel 3: channel 4: tgi3a tgi3b tgi3c tgi3d tci3v tgi4a tgi4b tci4c tci4d tgi4v interrupt request signals channel 0: channel 1: channel 2: tgi0a tgi0b tgi0c tgi0d tci0v tgi1a tgi1b tci1v tci1u tgi2a tgi2b tci2v tci2u tioc0a tioc0b tioc0c tioc0d tioc1a tioc1b tioc2a tioc2b input/output pins channel 0: channel 1: channel 2: /1 /4 /16 /64 /256 /1024 internal clock tioc3a tioc3b tioc3c tioc3d tioc4a tioc4b tioc4c tioc4d input/output pins channel 3: channel 4: dma transfer request signal channel 0: tgi0a channel 1: tgi1a channel 2: tgi2a channel 0: tgi3a channel 1: tgi4a dma transfer request signal tclka tclkb tclkc tclkd external clock divider figure 18.1 block diagram of mtu
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 521 of 982 rej09b0023-0400 18.2 input/output pins table 18.2 mtu pin configuration channel symbol i/o function all tclka input external clock a input pin (channel 1 phase counting mode a phase input) tclkb input external clock b input pin (channel 1 phase counting mode b phase input) tclkc input external clock c input pin (channel 2 phase counting mode a phase input) tclkd input external clock d input pin (channel 2 phase counting mode b phase input) 0 tioc0a i/o tgra_0 input capture inpu t/output compare output/pwm output pin tioc0b i/o tgrb_0 input capture input/output compare output/pwm output pin tioc0c i/o tgrc_0 input capture inpu t/output compare output/pwm output pin tioc0d i/o tgrd_0 input capture inpu t/output compare output/pwm output pin 1 tioc1a i/o tgra_1 input capture inpu t/output compare output/pwm output pin tioc1b i/o tgrb_1 input capture input/output compare output/pwm output pin 2 tioc2a i/o tgra_2 input capture inpu t/output compare output/pwm output pin tioc2b i/o tgrb_2 input capture input/output compare output/pwm output pin 3 tioc3a i/o tgra_3 input capture inpu t/output compare output/pwm output pin tioc3b i/o tgrb_3 input capture input/output compare output/pwm output pin tioc3c i/o tgrc_3 input capture inpu t/output compare output/pwm output pin tioc3d i/o tgrd_3 input capture inpu t/output compare output/pwm output pin 4 tioc4a i/o tgra_4 input capture inpu t/output compare output/pwm output pin tioc4b i/o tgrb_4 input capture input/output compare output/pwm output pin tioc4c i/o tgrc_4 input capture inpu t/output compare output/pwm output pin tioc4d i/o tgrd_4 input capture inpu t/output compare output/pwm output pin
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 522 of 982 rej09b0023-0400 18.3 register descriptions the mtu has the following registers. to distinguish registers in each channel, tcr for channel 0 is expressed as tcr_0. ? timer control register_0 (tcr_0) ? timer mode register_0 (tmdr_0) ? timer i/o control register h_0 (tiorh_0) ? timer i/o control register l_0 (tiorl_0) ? timer interrupt enable register_0 (tier_0) ? timer status register_0 (tsr_0) ? timer counter_0 (tcnt_0) ? timer general register a_0 (tgra_0) ? timer general register b_0 (tgrb_0) ? timer general register c_0 (tgrc_0) ? timer general register d_0 (tgrd_0) ? timer control register_1 (tcr_1) ? timer mode register_1 (tmdr_1) ? timer i/o control register _1 (tior_1) ? timer interrupt enable register_1 (tier_1) ? timer status register_1 (tsr_1) ? timer counter_1 (tcnt_1) ? timer general register a_1 (tgra_1) ? timer general register b_1 (tgrb_1) ? timer control register_2 (tcr_2) ? timer mode register_2 (tmdr_2) ? timer i/o control register_2 (tior_2) ? timer interrupt enable register_2 (tier_2) ? timer status register_2 (tsr_2) ? timer counter_2 (tcnt_2) ? timer general register a_2 (tgra_2) ? timer general register b_2 (tgrb_2) ? timer control register_3 (tcr_3) ? timer mode register_3 (tmdr_3) ? timer i/o control register h_3 (tiorh_3)
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 523 of 982 rej09b0023-0400 ? timer i/o control register l_3 (tiorl_3) ? timer interrupt enable register_3 (tier_3) ? timer status register_3 (tsr_3) ? timer counter_3 (tcnt_3) ? timer general register a_3 (tgra_3) ? timer general register b_3 (tgrb_3) ? timer general register c_3 (tgrc_3) ? timer general register d_3 (tgrd_3) ? timer control register_4 (tcr_4) ? timer mode register_4 (tmdr_4) ? timer i/o control register h_4 (tiorh_4) ? timer i/o control register l_4 (tiorl_4) ? timer interrupt enable register_4 (tier_4) ? timer status register_4 (tsr_4) ? timer counter_4 (tcnt_4) ? timer general register a_4 (tgra_4) ? timer general register b_4 (tgrb_4) ? timer general register c_4 (tgrc_4) ? timer general register d_4 (tgrd_4) common registers: ? timer start register (tstr) ? timer synchro register (tsyr) common registers for timers 3 and 4: ? timer output master enable register (toer) ? timer output control register (tocr) ? timer gate control register (tgcr) ? timer cycle data register (tcdr) ? timer dead time data register (tddr) ? timer subcounter (tcnts) ? timer cycle buffer register (tcbr)
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 524 of 982 rej09b0023-0400 18.3.1 timer control register (tcr) the tcr registers are 8-bit readab le/writable registers that cont rol the tcnt operation for each channel. the mtu has a total of five tcr regist ers, one for each channel (channel 0 to 4). tcr register settings should be conducted only when tcnt operation is stopped. bit bit name initial value r/w description 7 6 5 cclr2 cclr1 cclr0 0 0 0 r/w r/w r/w counter clear 2 to 0 these bits select the tcnt counter clearing source. see tables 18.3 and 18.4 for details. 4 3 ckeg1 ckeg0 0 0 r/w r/w clock edge 1 and 0 these bits select the input clock edge. when the input clock is counted using both edges, the input clock period is halved (e.g. p /4 both edges = /2 rising edge). if phase counting mode is used on channels 1 and 2, this setting is ignored and the phase counting mode setting has priority. internal clock edge selection is valid when the input clock is /4 or slower. when /1, or the overflow/underflow of another channel is selected for the input clock, although values can be written, counter operation compiles with the initial value. 00: count at rising edge 01: count at falling edge 1x: count at both edges [legend] x: don't care 2 1 0 tpsc2 tpsc1 tpsc0 0 0 0 r/w r/w r/w time prescaler 2 to 0 these bits select the tcnt counter clock. the clock source can be selected independently for each channel. see tables 18.5 to 18.8 for details.
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 525 of 982 rej09b0023-0400 table 18.3 cclr0 to cclr2 (channels 0, 3, and 4) channel bit 7 cclr2 bit 6 cclr1 bit 5 cclr0 description 0, 3, 4 0 0 0 tcnt clearing disabled 1 tcnt cleared by tgra compare match/input capture 1 0 tcnt cleared by tgrb compare match/input capture 1 tcnt cleared by counter clearing for another channel performing synchronous clearing/ synchronous operation * 1 1 0 0 tcnt clearing disabled 1 tcnt cleared by tgrc compare match/input capture * 2 1 0 tcnt cleared by tgrd compare match/input capture * 2 1 tcnt cleared by counter clearing for another channel performing synchronous clearing/ synchronous operation * 1 notes: 1. synchronous operation is set by setting the sync bit in tsyr to 1. 2. when tgrc or tgrd is used as a buffer re gister, tcnt is not cleared because the buffer register setting has priority, and comp are match/input capture does not occur. table 18.4 cclr0 to cclr2 (channels 1 and 2) channel bit 7 reserved * 2 bit 6 cclr1 bit 5 cclr0 description 1, 2 0 0 0 tcnt clearing disabled 1 tcnt cleared by tgra compare match/input capture 1 0 tcnt cleared by tgrb compare match/input capture 1 tcnt cleared by counter clearing for another channel performing synchronous clearing/ synchronous operation * 1 notes: 1. synchronous operation is select ed by setting the sync bit in tsyr to 1. 2. bit 7 is reserved in channels 1 and 2. this bit is always read as 0 and cannot be modified.
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 526 of 982 rej09b0023-0400 table 18.5 tpsc0 to tpsc2 (channel 0) channel bit 2 tpsc2 bit 1 tpsc1 bit 0 tpsc0 description 0 0 0 0 internal clock: counts on p /1 1 internal clock: counts on p /4 1 0 internal clock: counts on p /16 1 internal clock: counts on p /64 1 0 0 external clock: counts on tclka pin input 1 external clock: counts on tclkb pin input 1 0 external clock: counts on tclkc pin input 1 external clock: counts on tclkd pin input table 18.6 tpsc0 to tpsc2 (channel 1) channel bit 2 tpsc2 bit 1 tpsc1 bit 0 tpsc0 description 1 0 0 0 internal clock: counts on p /1 1 internal clock: counts on p /4 1 0 internal clock: counts on p /16 1 internal clock: counts on p /64 1 0 0 external clock: counts on tclka pin input 1 external clock: counts on tclkb pin input 1 0 internal clock: counts on p /256 1 counts on tcnt_2 overflow/underflow note: this setting is ignored when channel 1 is in phase counting mode.
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 527 of 982 rej09b0023-0400 table 18.7 tpsc0 to tpsc2 (channel 2) channel bit 2 tpsc2 bit 1 tpsc1 bit 0 tpsc0 description 2 0 0 0 internal clock: counts on p /1 1 internal clock: counts on p /4 1 0 internal clock: counts on p /16 1 internal clock: counts on p /64 1 0 0 external clock: counts on tclka pin input 1 external clock: counts on tclkb pin input 1 0 external clock: counts on tclkc pin input 1 internal clock: counts on p /1024 note: this setting is ignored when channel 2 is in phase counting mode. table 18.8 tpsc0 to tp sc2 (channels 3 and 4) channel bit 2 tpsc2 bit 1 tpsc1 bit 0 tpsc0 description 3, 4 0 0 0 internal clock: counts on p /1 1 internal clock: counts on p /4 1 0 internal clock: counts on p /16 1 internal clock: counts on p /64 1 0 0 internal clock: counts on p /256 1 internal clock: counts on p /1024 1 0 external clock: counts on tclka pin input 1 external clock: counts on tclkb pin input
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 528 of 982 rej09b0023-0400 18.3.2 timer mode register (tmdr) the tmdr registers are 8-bit readab le/writable registers that are used to set the operating mode of each channel. the mtu has five tmdr registers, one for each channel. tm dr register settings should be changed only when tcnt operation is stopped. bit bit name initial value r/w description 7, 6 ? all 1 ? reserved these bits are always read as 1. the write value should always be 1. 5 bfb 0 r/w buffer operation b specifies whether tgrb is to operate in the normal way, or tgrb and tgrd are to be used together for buffer operation. when tgrd is used as a buffer register, tgrd input captur e/output compare is not generated. in channels 1 and 2, which have no tgrd, bit 5 is reserved. it is always read as 0, and should only be written with 0. 0: tgrb and tgrd operate normally 1: tgrb and tgrd used together for buffer operation 4 bfa 0 r/w buffer operation a specifies whether tgra is to operate in the normal way, or tgra and tgrc are to be used together for buffer operation. when tgrc is used as a buffer register, tgrc input captur e/output compare is not generated. in channels 1 and 2, which have no tgrc, bit 4 is reserved. it is always read as 0, and should only be written with 0. 0: tgra and tgrd operate normally 1: tgra and tgrc used together for buffer operation 3 2 1 0 md3 md2 md1 md0 0 0 0 0 r/w r/w r/w r/w modes 3 to 0 these bits are used to set the timer operating mode. see table 18.9 for details.
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 529 of 982 rej09b0023-0400 table 18.9 md0 to md3 bit 3 md3 bit 2 md2 bit 1 md1 bit 0 md0 description 0 0 0 0 normal operation 1 reserved (do not set) 1 0 pwm mode 1 1 pwm mode 2 * 1 1 0 0 phase counting mode 1 * 2 1 phase counting mode 2 * 2 1 0 phase counting mode 3 * 2 1 phase counting mode 4 * 2 1 0 0 0 reset synchronous pwm mode * 3 1 reserved (do not set) 1 x reserved (do not set) 1 0 0 reserved (do not set) 1 complementary pwm mode 1 (transmit at peak) * 3 1 0 complementary pwm mode 2 (transmit at valley) * 3 1 complementary pwm mode 2 (transmit at peak and valley) * 3 [legend] x: don't care notes: 1. pwm mode 2 cannot be set for channels 3, 4. 2. phase counting mode cannot be set for channels 0, 3, 4. 3. reset synchronous pwm mode, complementary pwm mode can only be set for channel 3. when channel 3 is set to reset synchronous pwm mode or complementary pwm mode, the channel 4 settings become ine ffective and automatically conform to the channel 3 settings. however, do not set ch annel 4 to reset synchronous pwm mode or complementary pwm mode. reset synchronous pwm mode and complementary pwm mode cannot be set for channels 0, 1, 2.
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 530 of 982 rej09b0023-0400 18.3.3 timer i/o cont rol register (tior) the tior registers are 8-bit readable/writable re gisters that control the tgr registers. the mtu has eight tior registers, two each for channels 0, 3, and 4, and one each for channels 1 and 2. care is required as tior is affected by the tm dr setting. the initial output specified by tior is valid when the counter is stopped (the cst bit in tstr is cleared to 0). note also that, in pwm mode 2, the output at the point at which the counter is cleared to 0 is specified. when tgrc or tgrd is designated for buffer operation, this setting is invalid and the register operates as a buffer register. ? tiorh_0, tior_1, tior_2, tiorh_3, tiorh_4 bit bit name initial value r/w description 7 6 5 4 iob3 iob2 iob1 iob0 0 0 0 0 r/w r/w r/w r/w i/o control b3 to b0 specify the function of tgrb. see the following tables. tiorh_0: table 18.10 tior_1: table 18.12 tior_2: table 18.13 tiorh_3: table 18.14 tiorh_4: table 18.16 3 2 1 0 ioa3 ioa2 ioa1 ioa0 0 0 0 0 r/w r/w r/w r/w i/o control a3 to a0 specify the function of tgra. see the following tables. tiorh_0: table 18.18 tior_1: table 18.20 tior_2: table 18.21 tiorh_3: table 18.22 tiorh_4: table 18.24
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 531 of 982 rej09b0023-0400 ? tiorl_0, tiorl_3, tiorl_4 bit bit name initial value r/w description 7 6 5 4 iod3 iod2 iod1 iod0 0 0 0 0 r/w r/w r/w r/w i/o control d3 to d0 specify the function of tgrd. when tgrd is used as the buffer register of tgrb, this setting is disabled, and input capture/output compare does not occur. see the following tables. tiorl_0: table 18.11 tiorl_3: table 18.15 tiorl_4: table 18.17 3 2 1 0 ioc3 ioc2 ioc1 ioc0 0 0 0 0 r/w r/w r/w r/w i/o control c3 to c0 specify the function of tgrc. when tgrc is used as the buffer register of tgra, this setting is disabled, and input capture/output compare does not occur. see the following tables. tiorl_0: table 18.19 tiorl_3: table 18.23 tiorl_4: table 18.25
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 532 of 982 rej09b0023-0400 table 18.10 tiorh_0 (channel 0) description bit 7 iob3 bit 6 iob2 bit 5 iob1 bit 4 iob0 tgrb_0 function tioc0b pin function 0 output hold * 0 1 initial output is 0 0 output at compare match 0 initial output is 0 1 output at compare match 0 1 1 initial output is 0 toggle output at compare match 0 output hold 0 1 initial output is 1 0 output at compare match 0 initial output is 1 1 output at compare match 0 1 1 1 output compare register initial output is 1 toggle output at compare match 0 input capture at rising edge 0 1 input capture at falling edge 0 1 x input capture at both edges 1 1 x x input capture register capture input source is channel 1/count clock input capture at tcnt _1 count- up/count-down [legend] x: don't care note: * 0 is output until tior contents is specif ied after a power-on reset and entering standby mode.
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 533 of 982 rej09b0023-0400 table 18.11 tiorl_0 (channel 0) description bit 7 iod3 bit 6 iod2 bit 5 iod1 bit 4 iod0 tgrd_0 function tioc0d pin function 0 0 0 0 output hold * 1 1 initial output is 0 0 output at compare match 1 0 output compare register * 2 initial output is 0 1 output at compare match 1 initial output is 0 toggle output at compare match 1 0 0 output hold 1 initial output is 1 0 output at compare match 1 0 initial output is 1 1 output at compare match 1 initial output is 1 toggle output at compare match 1 0 0 0 input capture at rising edge 1 input capture at falling edge 1 x input capture at both edges 1 x x input capture register * 2 capture input source is channel 1/count clock input capture at tcnt _1 count-up/count-down * 2 [legend] x: don't care notes: 1. the low level output is retained until tior contents is specified after a power-on reset and entering standby mode. 2. when the bfb bit in tmdr_0 is set to 1 and tgrd_0 is used as a buffer register, this setting is invalid and input captur e/output compare is not generated.
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 534 of 982 rej09b0023-0400 table 18.12 tior_1 (channel 1) description bit 7 iob3 bit 6 iob2 bit 5 iob1 bit 4 iob0 tgrb_1 function tioc1b pin function 0 0 0 0 output hold * 1 output compare register initial output is 0 0 output at compare match 1 0 initial output is 0 1 output at compare match 1 initial output is 0 toggle output at compare match 1 0 0 output hold * 1 initial output is 1 0 output at compare match 1 0 initial output is 1 1 output at compare match 1 initial output is 1 toggle output at compare match 1 0 0 0 input capture at rising edge 1 input capture at falling edge 1 x input capture at both edges 1 x x input capture register input capture at generat ion of tgrc_0 compare match/input capture [legend] x: don't care note: * the low level output is retained until tior contents is specified after a power-on reset and entering standby mode.
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 535 of 982 rej09b0023-0400 table 18.13 tior_2 (channel 2) description bit 7 iob3 bit 6 iob2 bit 5 iob1 bit 4 iob0 tgrb_2 function tioc2b pin function 0 0 0 0 output hold * 1 output compare register initial output is 0 0 output at compare match 1 0 initial output is 0 1 output at compare match 1 initial output is 0 toggle output at compare match 1 0 0 output hold * 1 initial output is 1 0 output at compare match 1 0 initial output is 1 1 output at compare match 1 initial output is 1 toggle output at compare match 1 x 0 0 input capture at rising edge 1 input capture at falling edge 1 x input capture register input capture at both edges [legend] x: don't care note: * the low level output is retained until tior contents is specified after a power-on reset and entering standby mode.
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 536 of 982 rej09b0023-0400 table 18.14 tiorh_3 (channel 3) description bit 7 iob3 bit 6 iob2 bit 5 iob1 bit 4 iob0 tgrb_3 function tioc3b pin function 0 0 0 0 output hold * 1 output compare register initial output is 0 0 output at compare match 1 0 initial output is 0 1 output at compare match 1 initial output is 0 toggle output at compare match 1 0 0 output hold * 1 initial output is 1 0 output at compare match 1 0 initial output is 1 1 output at compare match 1 initial output is 1 toggle output at compare match 1 x 0 0 input capture at rising edge 1 input capture at falling edge 1 x input capture register input capture at both edges [legend] x: don't care note: * the low level output is retained until tior contents is specified after a power-on reset and entering standby mode.
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 537 of 982 rej09b0023-0400 table 18.15 tiorl_3 (channel 3) description bit 7 iod3 bit 6 iod2 bit 5 iod1 bit 4 iod0 tgrd_3 function tioc3d pin function 0 0 0 0 output hold * 1 1 output compare register * 2 initial output is 0 0 output at compare match 1 0 initial output is 0 1 output at compare match 1 initial output is 0 toggle output at compare match 1 0 0 output hold * 1 1 initial output is 1 0 output at compare match 1 0 initial output is 1 1 output at compare match 1 initial output is 1 toggle output at compare match 1 x 0 0 input capture at rising edge 1 input capture at falling edge 1 x input capture register * 2 input capture at both edges [legend] x: don't care notes: 1. the low level output is retained until tior contents is specified after a power-on reset and entering standby mode. 2. when the bfb bit in tmdr_3 is set to 1 and tgrd_3 is used as a buffer register, this setting is invalid and input captur e/output compare is not generated.
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 538 of 982 rej09b0023-0400 table 18.16 tiorh_4 (channel 4) description bit 7 iob3 bit 6 iob2 bit 5 iob1 bit 4 iob0 tgrb_4 function tioc4b pin function 0 0 0 0 output hold * 1 output compare register initial output is 0 0 output at compare match 1 0 initial output is 0 1 output at compare match 1 initial output is 0 toggle output at compare match 1 0 0 output hold * 1 initial output is 1 0 output at compare match 1 0 initial output is 1 1 output at compare match 1 initial output is 1 toggle output at compare match 1 x 0 0 input capture at rising edge 1 input capture at falling edge 1 x input capture register input capture at both edges [legend] x: don't care note: * the low level output is retained until tior contents is specified after a power-on reset and entering standby mode.
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 539 of 982 rej09b0023-0400 table 18.17 tiorl_4 (channel 4) description bit 7 iod3 bit 6 iod2 bit 5 iod1 bit 4 iod0 tgrb_4 function tioc4b pin function 0 0 0 0 output hold * 1 1 output compare register * 2 initial output is 0 0 output at compare match 1 0 initial output is 0 1 output at compare match 1 initial output is 0 toggle output at compare match 1 0 0 output hold * 1 1 initial output is 1 0 output at compare match 1 0 initial output is 1 1 output at compare match 1 initial output is 1 toggle output at compare match 1 x 0 0 input capture at rising edge 1 input capture at falling edge 1 x input capture register * 2 input capture at both edges [legend] x: don't care notes: 1. the low level output is retained until tior contents is specified after a power-on reset and entering standby mode. 2. when the bfb bit in tmdr_4 is set to 1 and tgrd_4 is used as a buffer register, this setting is invalid and input captur e/output compare is not generated.
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 540 of 982 rej09b0023-0400 table 18.18 tiorh_0 (channel 0) description bit 3 ioa3 bit 2 ioa2 bit 1 ioa1 bit 0 ioa0 tgra_0 function tioc0a pin function 0 0 0 0 output hold * 1 output compare register initial output is 0 0 output at compare match 1 0 initial output is 0 1 output at compare match 1 initial output is 0 toggle output at compare match 1 0 0 output hold * 1 initial output is 1 0 output at compare match 1 0 initial output is 1 1 output at compare match 1 initial output is 1 toggle output at compare match 1 0 0 0 input capture at rising edge 1 input capture at falling edge 1 x input capture at both edges 1 x x input capture register capture input source is channel 1/count clock input capture at tcnt _1 count-up/count-down [legend] x: don't care note: * the low level output is retained until tior contents is specified after a power-on reset and entering standby mode.
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 541 of 982 rej09b0023-0400 table 18.19 tiorl_0 (channel 0) description bit 3 ioc3 bit 2 ioc2 bit 1 ioc1 bit 0 ioc0 tgrc_0 function tioc0c pin function 0 0 0 0 output hold * 1 1 output compare register * 2 initial output is 0 0 output at compare match 1 0 initial output is 0 1 output at compare match 1 initial output is 0 toggle output at compare match 1 0 0 output hold * 1 1 initial output is 1 0 output at compare match 1 0 initial output is 1 1 output at compare match 1 initial output is 1 toggle output at compare match 1 0 0 0 input capture at rising edge 1 input capture at falling edge 1 x input capture at both edges 1 x x input capture register * 2 capture input source is channel 1/count clock input capture at tcnt _1 count-up/count-down [legend] x: don't care notes: 1. the low level output is retained until tior contents is specified after a power-on reset and entering standby mode. 2. when the bfa bit in tmdr_0 is set to 1 and tgrc_0 is used as a buffer register, this setting is invalid and input captur e/output compare is not generated.
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 542 of 982 rej09b0023-0400 table 18.20 tior_1 (channel 1) description bit 3 ioa3 bit 2 ioa2 bit 1 ioa1 bit 0 ioa0 tgra_1 function tioc1a pin function 0 0 0 0 output hold * 1 output compare register initial output is 0 0 output at compare match 1 0 initial output is 0 1 output at compare match 1 initial output is 0 toggle output at compare match 1 0 0 output hold * 1 initial output is 1 0 output at compare match 1 0 initial output is 1 1 output at compare match 1 initial output is 1 toggle output at compare match 1 0 0 0 input capture at rising edge 1 input capture at falling edge 1 x input capture at both edges 1 x x input capture register input capture at gener ation of channel 0/tgra_0 compare ma tch/input capture [legend] x: don't care note: * the low level output is retained until tior contents is specified after a power-on reset and entering standby mode.
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 543 of 982 rej09b0023-0400 table 18.21 tior_2 (channel 2) description bit 3 ioa3 bit 2 ioa2 bit 1 ioa1 bit 0 ioa0 tgra_2 function tioc2a pin function 0 0 0 0 output hold * 1 output compare register initial output is 0 0 output at compare match 1 0 initial output is 0 1 output at compare match 1 initial output is 0 toggle output at compare match 1 0 0 output hold * 1 initial output is 1 0 output at compare match 1 0 initial output is 1 1 output at compare match 1 initial output is 1 toggle output at compare match 1 x 0 0 input capture at rising edge 1 input capture at falling edge 1 x input capture register input capture at both edges [legend] x: don't care note: * the low level output is retained until tior contents is specified after a power-on reset and entering standby mode.
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 544 of 982 rej09b0023-0400 table 18.22 tiorh_3 (channel 3) description bit 3 ioa3 bit 2 ioa2 bit 1 ioa1 bit 0 ioa0 tgra_3 function tioc3a pin function 0 0 0 0 output hold * 1 output compare register initial output is 0 0 output at compare match 1 0 initial output is 0 1 output at compare match 1 initial output is 0 toggle output at compare match 1 0 0 output hold * 1 initial output is 1 0 output at compare match 1 0 initial output is 1 1 output at compare match 1 initial output is 1 toggle output at compare match 1 x 0 0 input capture at rising edge 1 input capture at falling edge 1 x input capture register input capture at both edges [legend] x: don't care note: * the low level output is retained until tior contents is specified after a power-on reset and entering standby mode.
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 545 of 982 rej09b0023-0400 table 18.23 tiorl_3 (channel 3) description bit 3 ioc3 bit 2 ioc2 bit 1 ioc1 bit 0 ioc0 tgrc_3 function tioc3c pin function 0 0 0 0 output hold * 1 1 output compare register * 2 initial output is 0 0 output at compare match 1 0 initial output is 0 1 output at compare match 1 initial output is 0 toggle output at compare match 1 0 0 output hold * 1 1 initial output is 1 0 output at compare match 1 0 initial output is 1 1 output at compare match 1 initial output is 1 toggle output at compare match 1 x 0 0 input capture at rising edge 1 input capture at falling edge 1 x input capture register * 2 input capture at both edges [legend] x: don't care notes: 1. the low level output is retained until tior contents is specified after a power-on reset and entering standby mode. 2. when the bfa bit in tmdr_3 is set to 1 and tgrc_3 is used as a buffer register, this setting is invalid and input captur e/output compare is not generated.
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 546 of 982 rej09b0023-0400 table 18.24 tiorh_4 (channel 4) description bit 3 ioa3 bit 2 ioa2 bit 1 ioa1 bit 0 ioa0 tgra_4 function tioc4a pin function 0 0 0 0 output hold * 1 output compare register initial output is 0 0 output at compare match 1 0 initial output is 0 1 output at compare match 1 initial output is 0 toggle output at compare match 1 0 0 output hold * 1 initial output is 1 0 output at compare match 1 0 initial output is 1 1 output at compare match 1 initial output is 1 toggle output at compare match 1 x 0 0 input capture at rising edge 1 input capture at falling edge 1 x input capture register input capture at both edges [legend] x: don't care note: * the low level output is retained until tior contents is specified after a power-on reset and entering standby mode.
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 547 of 982 rej09b0023-0400 table 18.25 tiorl_4 (channel 4) description bit 3 ioc3 bit 2 ioc2 bit 1 ioc1 bit 0 ioc0 tgra_4 function tioc4c pin function 0 0 0 0 output hold * 1 1 output compare register * 2 initial output is 0 0 output at compare match 1 0 initial output is 0 1 output at compare match 1 initial output is 0 toggle output at compare match 1 0 0 output hold * 1 1 initial output is 1 0 output at compare match 1 0 initial output is 1 1 output at compare match 1 initial output is 1 toggle output at compare match 1 x 0 0 input capture at rising edge 1 input capture at falling edge 1 x input capture register input capture at both edges [legend] x: don't care notes: 1. the low level output is retained until tior contents is specified after a power-on reset and entering standby mode. 2. when the bfa bit in tmdr_4 is set to 1 and tgrc_4 is used as a buffer register, this setting is invalid and input captur e/output compare is not generated.
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 548 of 982 rej09b0023-0400 18.3.4 timer interrupt enable register (tier) the tier registers are 8-bit read able/writable registers that control enabling or disabling of interrupt requests for each channel. the mtu has five tier registers, one for each channel. bit bit name initial value r/w description 7 ttge 0 r/w a/d conversion start request enable enables or disables generat ion of a/d conversion start requests by tgra input capture/compare match. 0: a/d conversion start request generation disabled 1: a/d conversion start request generation enabled 6 tgfasel 0 r/w tgfa interrupt/dma transfer select selects the tgfa interrupt request or dma transfer request when the tgfa flag in tgra is set to 1. 0: interrupt request 1: dma transfer request 5 tcieu 0 r/w underflow interrupt enable enables or disables interrupt requests (tciu) by the tcfu flag when the tcfu fl ag in tsr is set to 1 in channels 1 and 2. in channels 0, 3, and 4, bit 5 is reserved. it is always read as 0, and should on ly be written with 0. 0: interrupt requests (tciu) by tcfu disabled 1: interrupt requests (tciu) by tcfu enabled 4 tciev 0 r/w overflow interrupt enable enables or disables interrupt requests (tciv) by the tcfv flag when the tcfv flag in tsr is set to 1. 0: interrupt requests (tciv) by tcfv disabled 1: interrupt requests (tciv) by tcfv enabled
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 549 of 982 rej09b0023-0400 bit bit name initial value r/w description 3 tgied 0 r/w tgr interrupt enable d enables or disables interrupt requests (tgid) by the tgfd bit when the tgfd bit in tsr is set to 1 in channels 0, 3, and 4. in channels 1 and 2, bit 3 is reserved. it is always read as 0, and should only be written with 0. 0: interrupt requests (tgid ) by tgfd bit disabled 1: interrupt requests (tgid) by tgfd bit enabled 2 tgiec 0 r/w tgr interrupt enable c enables or disables interrupt requests (tgic) by the tgfc bit when the tgfc bit in tsr is set to 1 in channels 0, 3, and 4. in channels 1 and 2, bit 2 is reserved. it is always read as 0, and should only be written with 0. 0: interrupt requests (tgic ) by tgfc bit disabled 1: interrupt requests (tgic) by tgfc bit enabled 1 tgieb 0 r/w tgr interrupt enable b enables or disables interrupt requests (tgib) by the tgfb bit when the tgfb bit in tsr is set to 1. 0: interrupt requests (tgib) by tgfb bit disabled 1: interrupt requests (tgib) by tgfb bit enabled 0 tgiea 0 r/w tgr interrupt enable a enables or disables interrupt requests (tgia) by the tgfa bit and dma transfer when the tgfa bit in tsr is set to 1. 0: interrupt requests (tgia) by tgfa bit and dma transfer disabled 1: interrupt requests (tgia) by tgfa bit and dma transfer enabled note: do not change the setting of the timer interrupt enable register (tier) during dma transfer.
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 550 of 982 rej09b0023-0400 18.3.5 timer status register (tsr) the tsr registers are 8-bit readable/writable regist ers that indicate the status of each channel. the mtu has five tsr registers, one for each channel. bit bit name initial value r/w description 7 tcfd 1 r count direction flag status flag that shows the direction in which tcnt counts in channels 1, 2, 3, and 4. in channel 0, bit 7 is reserved. it is always read as 1, and should only be written with 1. 0: tcnt counts down 1: tcnt counts up 6 ? 1 r reserved this bit is always read as 1. the write value should always be 1. 5 tcfu 0 r/(w) underflow flag status flag that indicate s that tcnt underflow has occurred when channels 1 and 2 are set to phase counting mode. only 0 can be written, for flag clearing. in channels 0, 3, and 4, bit 5 is reserved. it is always read as 0, and should on ly be written with 0. [setting condition] ? when the tcnt value underflows (changes from h'0000 to h'ffff) [clearing condition] ? when 0 is written to tcfu after reading tcfu = 1
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 551 of 982 rej09b0023-0400 bit bit name initial value r/w description 4 tcfv 0 r/(w) overflow flag status flag that indicates that tcnt overflow has occurred. only 0 can be written, for flag clearing. [setting conditions] ? when the tcnt value overflows (changes from h'ffff to h'0000 ) ? in channel 4, when tcnt_4 is underflowed (h'0001 h'0000) in complementary pwm mode. [clearing condition] ? when 0 is written to tcfv after reading tcfv = 1 3 tgfd 0 r/(w) input capture/output compare flag d status flag that indicates the occurrence of tgrd input capture or compare match in channels 0, 3, and 4. only 0 can be written, for flag clearing. in channels 1 and 2, bit 3 is reserved. it is always read as 0, and should only be written with 0. [setting conditions] ? when tcnt = tgrd and tgrd is functioning as output compare register ? when tcnt value is transferred to tgrd by input capture signal and tgrd is functioning as input capture register [clearing condition] ? when 0 is written to tgfd after reading tgfd = 1
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 552 of 982 rej09b0023-0400 bit bit name initial value r/w description 2 tgfc 0 r/(w) input capture/output compare flag c status flag that indicates the occurrence of tgrc input capture or compare match in channels 0, 3, and 4. only 0 can be written, for flag clearing. in channels 1 and 2, bit 2 is reserved. it is always read as 0, and should only be written with 0. [setting conditions] ? when tcnt = tgrc and tgrc is functioning as output compare register ? when tcnt value is transferred to tgrc by input capture signal and tgrc is functioning as input capture register [clearing condition] ? when 0 is written to tgfc after reading tgfc = 1 1 tgfb 0 r/(w) input capture/output compare flag b status flag that indicates t he occurrence of tgrb input capture or compare match. only 0 can be written, for flag clearing. [setting conditions] ? when tcnt = tgrb and tgrb is functioning as output compare register ? when tcnt value is transferred to tgrb by input capture signal and tgrb is functioning as input capture register [clearing condition] ? when 0 is written to tgfb after reading tgfb = 1
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 553 of 982 rej09b0023-0400 bit bit name initial value r/w description 0 tgfa 0 r/(w) input capture/output compare flag a status flag that indicates t he occurrence of tgra input capture or compare match. only 0 can be written, for flag clearing. [setting conditions] ? when tcnt = tgra and tgra is functioning as output compare register ? when tcnt value is transferred to tgra by input capture signal and tgra is functioning as input capture register [clearing condition] ? when 0 is written to tgfa after reading tgfa = 1 for dma, 0 must not be written to after reading tgfa = 1. this flag is cleared only by hardware. * note: write 0 after reading tgfa=1 only when a dma address error occurs during a dma read cycle. 18.3.6 timer counter (tcnt) the tcnt registers are 16-bit r eadable/writable counters. the mt u has five tcnt counters, one for each channel. the tcnt counters are initialized to h'0000 by a power-on reset and in standby mode. the tcnt counters cannot be accessed in 8-bit un its; they must always be accessed as a 16-bit unit. 18.3.7 timer general register (tgr) the tgr registers are dual function 16-bit readable/writable registers, functioning as either output compare or input capture register s. the mtu has 16 tgr registers, four each for channels 0, 3, and 4 and two each for channels 1 and 2. tgrc and tgrd for channels 0, 3, and 4 can also be designated for operation as buffer registers. th e tgr registers cannot be accessed in 8-bit units; they must always be accessed in 16-bit units. tg r buffer register combinations are tgra to tgrc and tgrb to tgrd.
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 554 of 982 rej09b0023-0400 18.3.8 timer start register (tstr) tstr is an 8-bit readable/writable register that selects operation/stoppage for channels 0 to 4. when setting the operating mode in tmdr or setting the count clock in tcr, first stop the tcnt counter. bit bit name initial value r/w description 7 6 cst4 cst3 0 0 r/w r/w counter start 4 and 3 these bits select operat ion or stoppage for tcnt. if 0 is written to the cst bit during operation with the tioc pin designated for output, the counter stops but the tioc pin output compare output level is retained. if tior is written to when the cst bit is cleared to 0, the pin output level will be changed to the set initial output value. 0: tcnt_4 and tcnt_3 co unt operation is stopped 1: tcnt_4 and tcnt_3 per forms count operation 5 to 3 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 2 1 0 cst2 cst1 cst0 0 0 0 r/w r/w r/w counter start 2 to 0 these bits select operat ion or stoppage for tcnt. if 0 is written to the cst bit during operation with the tioc pin designated for output, the counter stops but the tioc pin output compare output level is retained. if tior is written to when the cst bit is cleared to 0, the pin output level will be changed to the set initial output value. 0: tcnt_2 and tcnt_0 co unt operation is stopped 1: tcnt_2 and tcnt_0 per forms count operation 18.3.9 timer synchro register (tsyr) tsyr is an 8-bit readable/writable register th at selects independent operation or synchronous operation for the channel 0 to 4 tcnt counters. a channel performs synchronous operation when the corresponding bit in tsyr is set to 1.
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 555 of 982 rej09b0023-0400 bit bit name initial value r/w description 7 6 sync4 sync3 0 0 r/w r/w timer synchro 4 and 3 these bits are used to select whether operation is independent of or synchronized with other channels. when synchronous operation is selected, the tcnt synchronous presetting of multiple channels, and synchronous clearing by counter clearing on another channel, are possible. to set synchronous operation, the sync bits for at least two channels must be set to 1. to set synchronous clearing, in addition to the sync bit , the tcnt clearing source must also be set by means of bits cclr0 to cclr2 in tcr. 0: tcnt_4 and tcnt_3 oper ate independently (tcnt presetting/clearing is unrelated to other channels) 1: tcnt_4 and tcnt_3 performs synchronous operation tcnt synchronous presetting/synchronous clearing is possible 5 to 3 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 2 1 0 sync2 sync1 sync0 0 0 0 r/w r/w r/w timer synchro 2 to 0 these bits are used to select whether operation is independent of or synchronized with other channels. when synchronous operation is selected, the tcnt synchronous presetting of multiple channels, and synchronous clearing by counter clearing on another channel, are possible. to set synchronous operation, the sync bits for at least two channels must be set to 1. to set synchronous clearing, in addition to the sync bit , the tcnt clearing source must also be set by means of bits cclr0 to cclr2 in tcr. 0: tcnt_2 to tcnt_0 operat es independently (tcnt presetting /clearing is unrelated to other channels). 1: tcnt_2 to tcnt_0 performs synchronous operation. tcnt synchronous presetting/synchronous clearing is possible.
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 556 of 982 rej09b0023-0400 18.3.10 timer output master enable register (toer) toer is an 8-bit readable/writable register that enables/disables output settings for output pins tioc4d, tioc4c, tioc3d, tioc4b, tioc4a, and tioc3b. these pins do not output correctly if the toer bits have not been set. set toer of ch3 and ch4 prior to setting tior of ch3 and ch4. bit bit name initial value r/w description 7, 6 ? all 1 r reserved these bits are always read as 1. the write value should always be 1. 5 oe4d 0 r/w master enable tioc4d this bit enables/disables the tioc4d pin mtu output. 0: mtu output is disabled 1: mtu output is enabled 4 oe4c 0 r/w master enable tioc4c this bit enables/disables the tioc4c pin mtu output. 0: mtu output is disabled 1: mtu output is enabled 3 oe3d 0 r/w master enable tioc3d this bit enables/disables the tioc3d pin mtu output. 0: mtu output is disabled 1: mtu output is enabled 2 oe4b 0 r/w master enable tioc4b this bit enables/disables the tioc4b pin mtu output. 0: mtu output is disabled 1: mtu output is enabled 1 oe4a 0 r/w master enable tioc4a this bit enables/disables the tioc4a pin mtu output. 0: mtu output is disabled 1: mtu output is enabled 0 oe3b 0 r/w master enable tioc3b this bit enables/disables the tioc3b pin mtu output. 0: mtu output is disabled 1: mtu output is enabled
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 557 of 982 rej09b0023-0400 18.3.11 timer output co ntrol register (tocr) tocr is an 8-bit readable/writable register that enables/disables pwm synchronized toggle output in complementary pwm mode/reset synchronized pwm mode, and controls output level inversion of pwm output. bit bit name initial value r/w description 7 ? 0 r reserved this bit is always read as 0. the write value should always be 0. 6 psye 0 r/w pwm synchronous output enable this bit selects the enable /disable of toggle output synchronized with the pwm period. 0: toggle output is disabled 1: toggle output is enabled 5 to 2 ? all 0 r reserved these bits are always read as 0. only 0 should be written to this bit. 1 olsn 0 r/w output level select n this bit selects the reverse phase output level in reset- synchronized pwm mode/complementary pwm mode. see table 18.26 0 olsp 0 r/w output level select p this bit selects the positive phase output level in reset- synchronized pwm mode/complementary pwm mode. see table 18.27. table 18.26 output level select function bit 1 function compare match output olsn initial output active level increment count decrement count 0 high level low level high level low level 1 low level high level low level high level note: the reverse phase waveform initial output val ue changes to active level after elapse of the dead time after count start.
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 558 of 982 rej09b0023-0400 table 18.27 output level select function bit 1 function compare match output olsp initial output active level increment count decrement count 0 high level low level low level high level 1 low level high level high level low level figure 18.2 shows an example of complementary pwm mode output (one phase) when olsn = 1, olsp = 1. tcnt_3, and tcnt_4 values tgra_3 tgra_4 tddr h'0000 time tcnt_4 tcnt_3 positive phase output reverse phase output active level compare match output (up count) initial output initial output active level compare match output (down count) compare match output (down count) compare match output (up count) active level figure 18.2 complementary pwm mode output level example
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 559 of 982 rej09b0023-0400 18.3.12 timer gate cont rol register (tgcr) tgcr is an 8-bit readable/writable register that controls the waveform output necessary for brushless dc motor control in reset-synchronized pwm mode/complementary pwm mode. these register settings are ineffective for anything other than complementary pwm mode/reset- synchronized pwm mode. bit bit name initial value r/w description 7 ? 1 r reserved this bit is always read as 1. the write value should always be 1. 6 bdc 0 r/w brushless dc motor this bit selects whether to make the functions of this register (tgcr) effective or ineffective. 0: ordinary output 1: functions of this register are made effective 5 n 0 r/w reverse phase output (n) control this bit selects whether the level output or the reset- synchronized pwm/complementary pwm output while the reverse pins (tioc3d, tioc4c, and tioc4d) are on-output. 0: level output 1: reset synchronized pwm/complementary pwm output 4 p 0 r/w positive phase output (p) control this bit selects whether the level output or the reset- synchronized pwm/complementary pwm output while the positive pin (tioc3b, tioc4a, and tioc4b) are on-output. 0: level output 1: reset synchronized pwm/complementary pwm output
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 560 of 982 rej09b0023-0400 bit bit name initial value r/w description 3 fb 0 r/w external feedback signal enable this bit selects whether the switching of the output of the positive/reverse phase is carried out automatically with the mtu/channel 0 tgra, tgrb, tgrc input capture signals or by writing 0 or 1 to bits 2 to 0 in tgcr. 0: output switching is carried out by external input (input sources are channel 0 tgra, tgrb, tgrc input capture signal) 1: output switching is carri ed out by software (tgcr's uf, vf, wf settings). 2 1 0 wf vf uf 0 0 0 r/w r/w r/w output phase switch 2 to 0 these bits set the posit ive phase/negative phase output phase on or off state. the setting of these bits is valid only when the fb bit in this register is set to 1. in this case, the setting of bits 2 to 0 is a substitute for external input. see table 18.28. table 18.28 output level select function function bit 2 bit 1 bit 0 tioc3b tioc4a tioc4b tioc3d tioc4c tioc4d wf vf uf u phase v phase w phase u phase v phase w phase 0 0 0 off off off off off off 1 on off off off off on 1 0 off on off on off off 1 off on off off off on 1 0 0 off off on off on off 1 on off off off on off 1 0 off off on on off off 1 off off off off off off
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 561 of 982 rej09b0023-0400 18.3.13 timer subcounter (tcnts) tcnts is a 16-bit read-only counter that is used only in complementary pwm mode. note: accessing tcnts in 8-bit units is prohibited. always access in 16-bit units. 18.3.14 timer dead time data register (tddr) tddr is a 16-bit register, used only in complementary pwm mode, that specifies the tcnt_3 and tcnt_4 counter offset values. in comp lementary pwm mode, when the tcnt_3 and tcnt_4 counters are cleared and then restarted, the tddr value is loaded into the tcnt_3 counter and the count operation starts. note: accessing tddr in 8-bit units is prohibited. always access in 16-bit units. 18.3.15 timer period data register (tcdr) tcdr is a 16-bit register used only in complementary pwm mode. set half the pwm carrier sync value as the tcdr value. this register is constantly compared with the tcnts counter in complementary pwm mode, and when a match oc curs, the tcnts counter switches direction (decrement to increment). note: accessing tcdr in 8-bit units is prohibited. always access in 16-bit units. 18.3.16 timer period buffer register (tcbr) tcbr is a 16-bit register used only in comple mentary pwm mode. it functions as a buffer register for tcdr. the tcbr values are transfe rred to tcdr with the transfer timing set in tmdr. note: accessing tcbr in 8-b it units is prohibited. alwa ys access in 16-bit units.
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 562 of 982 rej09b0023-0400 18.3.17 bus master interface the timer counters (tcnt), general registers (tgr), timer subcounter (tcnts), timer period buffer register (tcbr), and timer dead time data re gister (tddr), and timer period data register (tcdr) are 16-bit registers. a 16-bit data bus to the bus master enables 16-bit read/writes. 8-bit read/write is not possible. always access in 16-bit units. all registers other than the above registers are 8-bi t registers. these are connected to the cpu by a 16-bit data bus, so 16-bit read/writes and 8-bit read/writes are both possible. 18.4 operation 18.4.1 basic functions each channel has a tcnt and tgr register. tcnt performs up-counting, an d is also capable of free-running operation, synchronous counting, and external event counting. each tgr can be used as an input captur e register or output compare register. always set the mtu external pins function using the pin function controller (pfc). ? counter operation when one of bits cst0 to cst4 is set to 1 in tstr, the tcnt counter for the corresponding channel begins counting. tcnt can operate as a free-running counter, periodic counter, for example.
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 563 of 982 rej09b0023-0400 example of count operation setting procedure: figure 18.3 shows an example of the count operation setting procedure. operation selection select counter clock periodic counter select counter clearing source select output compare register set period free-running counter start count operation start count operation [1] [2] [3] [4] [5] [5] [1] select the counter clock with bits tpsc2 to tpsc0 in tcr. at the same time, select the input clock edge with bits ckeg1 and ckeg0 in tcr. [2] for periodic counter operation, select the tgr to be used as the tcnt clearing source with bits cclr2 to cclr0 in tcr. [3] designate the tgr selected in [2] as an output compare register by means of tior. [4] set the periodic counter cycle in the tgr selected in [2]. [5] set the cst bit in tstr to 1 to start the counter operation. figure 18.3 example of coun ter operation setting procedure free-running count operation and periodic count operation: immediately after a reset, the mtu's tcnt counters are all designated as free-running counters. when the relevant bit in tstr is set to 1 the corresponding tcnt counter starts up-count operation as a free-running counter. when tcnt overflows (from h'ffff to h'0000), the tcfv bit in tsr is set to 1. if the value of the corresponding tciev bit in tier is 1 at this point, the mtu requests an interrupt. after overflow, tcnt starts counting up again from h'0000. figure 18.4 illustrates free-running counter operation.
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 564 of 982 rej09b0023-0400 tcnt value h'ffff h'0000 cst bit tcfv time figure 18.4 free-running counter operation when compare match is selected as the tcnt cl earing source, the tcnt co unter for the relevant channel performs periodic count operation. the tgr register for setting the period is designated as an output compare register, and counter clearing by compare match is selected by means of bits cclr0 to cclr2 in tcr. after the settings have been made, tcnt starts up-count operation as a periodic counter when the corresponding bit in tstr is set to 1. when the count value matches the value in tgr, the tgf bit in tsr is set to 1 and tcnt is cleared to h'0000. if the value of the corresponding tgie bit in tier is 1 at this point, the tpu requests an interrupt. after a compare match, tcnt starts counting up again from h'0000. figure 18.5 illustrates periodic counter operation. tcnt value tgr h'0000 cst bit tgf time counter cleared by tgr compare match flag cleared by software or dma activation figure 18.5 periodic counter operation ? waveform output by compare match the mtu can perform 0, 1, or toggle output from the corresponding output pin using compare match.
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 565 of 982 rej09b0023-0400 example of setting procedure for wa veform output by compare match: figure 18.6 shows an example of the setting procedure fo r waveform output by compare match output selection select waveform output mode set output timing start count operation [1] [2] [3] [1] select initial value 0 output or 1 output, and compare match output value 0 output, 1 output, or toggle output, by means of tior. the set initial value is output at the tioc pin until the first compare match occurs. [2] set the timing for compare match generation in tgr. [3] set the cst bit in tstr to 1 to start the count operation. figure 18.6 example of setting procedu re for waveform output by compare match examples of waveform output operation: figure 18.7 shows an example of 0 output/1 output. in this example tcnt has been designated as a free-running counter, and settings have been made such that 1 is output by compare match a, and 0 is output by compare match b. when the set level and the pin level coincide, the pin level does not change. tcnt value h'ffff h'0000 tioca tiocb time tgra tgrb no change no change no change no change 1 output 0 output figure 18.7 example of 0 output/1 output operation
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 566 of 982 rej09b0023-0400 figure 18.8 shows an example of toggle output. in this example, tcnt has b een designated as a periodic co unter (with counter clearing on compare match b), and settings have been made such that the output is toggled by both compare match a and compare match b. tcnt value h'ffff h'0000 tiocb tioca time tgrb tgra toggle output toggle output counter cleared by tgrb compare match figure 18.8 example of toggle output operation ? input capture function the tcnt value can be transferred to tgr on detection of the tioc pin input edge. rising edge, falling edge, or both edges can be selected as the detected edge. for channels 0 and 1, it is also possible to specify another channel's co unter input clock or compare match signal as the input capture source. note: when another channel's counter input clock is used as the input capture input for channels 0 and 1, /1 should not be selected as the counter input clock used for input capture input. input capture will not be generated if /1 is selected.
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 567 of 982 rej09b0023-0400 example of input capture operation setting procedure: figure 18.9 shows an example of the input capture operation setting procedure. input selection select input capture input start count [1] [2] [1] designate tgr as an input capture register by means of tior, and select rising edge, falling edge, or both edges as the input capture source and input signal edge. [2] set the cst bit in tstr to 1 to start the count operation. figure 18.9 example of input ca pture operation setting procedure example of input capture operation: figure 18.10 shows an example of input capture operation. in this example both rising and falling edges have been selected as the tioca pin input capture input edge, the falling edge has been selected as the tiocb pin input capture input edge, and counter clearing by tgrb input capture has been designated for tcnt.
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 568 of 982 rej09b0023-0400 tcnt value h'0180 h'0000 tioca tgra h'0010 h'0005 counter cleared by tiocb input (falling edge) h'0160 h'0005 h'0160 h'0010 tgrb h'0180 tiocb time figure 18.10 example of input capture operation 18.4.2 synchronous operation in synchronous operation, the values in a number of tcnt counters can be rewritten simultaneously (synchronous presetting). also, a number of tcnt counters can be cleared simultaneously by making the appropriate setting in tcr (synchronous clearing). synchronous operation enables tgr to be incr emented with respect to a single time base. channels 0 to 4 can all be designated for synchronous operation.
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 569 of 982 rej09b0023-0400 example of synchronous operation setting procedure: figure 18.11 shows an example of the synchronous operatio n setting procedure. no yes set synchronous operation clearing source generation channel? select counter clearing source start count set synchronous counter clearing start count [1] [3] [5] [4] [5] [2] synchronous operation selection [1] set to 1 the sync bits in tsyr corresponding to the channels to be designated for synchronous operation. [2] when the tcnt counter of any of the channels designated for synchronous operation is written to, the same value is simultaneously written to the other tcnt counters. [3] use bits cclr2 to cclr0 in tcr to specify tcnt clearing by input capture/output compare, etc. [4] use bits cclr2 to cclr0 in tcr to designate synchronous clearing for the counter clearing source. [5] set to 1 the cst bits in tstr for the relevant channels, to start the count operation. set tcnt synchronous presetting synchronous clearing figure 18.11 example of synchronous operation setting procedure
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 570 of 982 rej09b0023-0400 example of synchronous operation: figure 18.12 shows an example of synchronous operation. in this example, synchronous operation and pwm mode 1 have been designated for channels 0 to 2, tgrb_0 compare match has been set as the channel 0 counter clearing source, and synchronous clearing has been set for the channel 1 and 2 counter clearing source. three-phase pwm waveforms are output from pins tioc0a, tioc1a, and tioc2a. at this time, synchronous presetting, and synchron ous clearing by tgrb_0 compare match, are performed for channel 0 to 2 tcnt counters, and the data set in tgrb_0 is used as the pwm cycle. for details of pwm modes, see section 18.4.5, pwm modes. tcnt0 to tcnt2 values h'0000 tioca_0 tioca_1 tgrb_0 synchronous clearing by tgrb_0 compare match tgra_2 tgra_1 tgrb_2 tgra_0 tgrb_1 tioca_2 time figure 18.12 example of synchronous operation
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 571 of 982 rej09b0023-0400 18.4.3 buffer operation buffer operation, provided for channels 0, 3, and 4, enables tgrc and tgrd to be used as buffer registers. buffer operation differs depending on whether tgr has been designated as an input capture register or as a compare match register. table 18.29 shows the register combinations used in buffer operation. table 18.29 register combinat ions in buffer operation channel timer general re gister buffer register 0 tgra_0 tgrc_0 tgrb_0 tgrd_0 3 tgra_3 tgrc_3 tgrb_3 tgrd_3 4 tgra_4 tgrc_4 tgrb_4 tgrd_4 ? when tgr is an output compare register when a compare match occurs, the value in the bu ffer register for the corresponding channel is transferred to the timer general register. this operation is illustrated in figure 18.13. buffer register timer general register tcnt comparator compare match signal figure 18.13 compare match buffer operation
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 572 of 982 rej09b0023-0400 ? when tgr is an inpu t capture register when input capture occurs, the value in tcnt is transferred to tgr and the value previously held in the timer general register is transferred to the buffer register. this operation is illustrated in figure 18.14. buffer register timer general register tcnt input capture signal figure 18.14 input capture buffer operation example of buffer operation setting procedure: figure 18.15 shows an example of the buffer operation setting procedure. buffer operation select tgr function set buffer operation start count [1] [2] [3] [1] designate tgr as an input capture register or output compare register by means of tior. [2] designate tgr for buffer operation with bits bfa and bfb in tmdr. [3] set the cst bit in tstr to 1 start the count operation. figure 18.15 example of buffe r operation setting procedure
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 573 of 982 rej09b0023-0400 examples of buffer operation: ? when tgr is an output compare register figure 18.16 shows an operation example in which pwm mode 1 has been designated for channel 0, and buffer operation has been designated for tgra and tgrc. the settings used in this example are tcnt clearing by compar e match b, 1 output at compare match a, and 0 output at compare match b. as buffer operation has been set, when comp are match a occurs the output changes and the value in buffer register tgrc is simultaneously transferred to timer general register tgra. this operation is repeated each time that compare match a occurs. for details of pwm modes, see section 18.4.5, pwm modes. tcnt value tgrb_0 h'0000 tgrc_0 tgra_0 h'0200 h'0520 tioca h'0200 h'0450 h'0520 h'0450 tgra_0 h'0450 h'0200 transfer time figure 18.16 example of buffer operation (1) ? when tgr is an inpu t capture register figure 18.17 shows an operation example in which tgra has been designated as an input capture register, and buffer operation has been designated for tgra and tgrc. counter clearing by tgra input capture has been set for tcnt, and both rising and falling edges have been selected as the tioca pin input capture input edge. as buffer operation has been set, when the tcnt value is stored in tgra upon the occurrence of input capture a, the value previously stored in tgra is simultaneously transferred to tgrc.
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 574 of 982 rej09b0023-0400 tcnt value h'09fb h'0000 tgrc time h'0532 tioca tgra h'0f07 h'0532 h'0f07 h'0532 h'0f07 h'09fb figure 18.17 example of buffer operation (2) 18.4.4 cascaded operation in cascaded operation, two 16-bit counters for different channels are used together as a 32-bit counter. this function works by counting the channel 1 counter clock upon overflow/underflow of tcnt_2 as set in bits tpsc0 to tpsc2 in tcr. underflow occurs only when the lower 16-bit tcnt is in phase-counting mode. table 18.30 shows the register combinations used in cascaded operation. note: when phase counting mode is set for channel 1 or 4, the counter clock setting is invalid and the counters operates independently in phase counting mode. table 18.30 cascaded combinations combination upper 16 bits lower 16 bits channels 1 and 2 tcnt_1 tcnt_2
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 575 of 982 rej09b0023-0400 example of cascaded oper ation setting procedure: figure 18.18 shows an example of the setting procedure for cascaded operation. cascaded operation set cascading start count [1] [2] [1] set bits tpsc2 to tpsc0 in the channel 1 tcr to b'1111 to select tcnt_2 overflow/ underflow counting. [2] set the cst bit in tstr for the upper and lower channel to 1 to start the count operation. figure 18.18 cascaded op eration setting procedure examples of cascaded operation: figure 18.19 illustrates the operation when tcnt_2 overflow/underflow counting has been set for tcnt_1 and phase counting mode has been designated for channel 2. tcnt_1 is incremented by tcnt_2 overflow and decremented by tcnt_2 underflow. tclkc tcnt_2 fffd tcnt_1 0001 tclkd fffe ffff 0000 0001 0002 0001 0000 ffff 0000 0000 figure 18.19 example of cascaded operation
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 576 of 982 rej09b0023-0400 18.4.5 pwm modes in pwm mode, pwm waveforms are output from the output pins. the output level can be selected as 0, 1, or toggle output in respon se to a compare match of each tgr. tgr registers settings can be used to output a pwm waveform in the range of 0% to 100% duty. designating tgr compare match as the counter clearin g source enables the period to be set in that register. all channels can be designated for pwm mode independently. synchronous operation is also possible. there are two pwm modes, as described below. ? pwm mode 1 pwm output is generated from the tioca and tiocc pins by pairing tgra with tgrb and tgrc with tgrd. the output specified by bits io a0 to ioa3 and ioc0 to ioc3 in tior is output from the tioca and tiocc pins at compare matches a and c, and the output specified by bits iob0 to iob3 and iod0 to iod3 in tior is output at compare matches b and d. the initial output value is the value set in tgra or tgrc. if the set values of paired tgrs are identical, the output value does not change when a compare match occurs. in pwm mode 1, a maximum 8-phase pwm output is possible. ? pwm mode 2 pwm output is generated using one tgr as the cycle register and the others as duty registers. the output specified in tior is performed by means of compare matches. upon counter clearing by a synchronization regi ster compare match, the output va lue of each pin is the initial value set in tior. if the set values of the cy cle and duty registers ar e identical, the output value does not change when a compare match occurs. in pwm mode 2, a maximum 8-phase pwm output is possible in combination use with synchronous operation.
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 577 of 982 rej09b0023-0400 the correspondence between pwm output pins and registers is shown in table 18.31. table 18.31 pwm output registers and output pins output pins channel registers pwm mode 1 pwm mode 2 tgra_0 tioc0a tgrb_0 tioc0a tioc0b tgrc_0 tioc0c 0 tgrd_0 tioc0c tioc0d tgra_1 tioc1a 1 tgrb_1 tioc1a tioc1b tgra_2 tioc2a 2 tgrb_2 tioc2a tioc2b tgra_3 setting prohibited tgrb_3 tioc3a setting prohibited tgrc_3 setting prohibited 3 tgrd_3 tioc3c setting prohibited tgra_4 setting prohibited tgrb_4 tioc4a setting prohibited tgrc_4 setting prohibited 4 tgrd_4 tioc4c setting prohibited note: in pwm mode 2, pwm output is not possible fo r the tgr register in which the period is set.
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 578 of 982 rej09b0023-0400 example of pwm mode setting procedure: figure 18.20 shows an example of the pwm mode setting procedure. pwm mode select counter clock select counter clearing source select waveform output level set tgr set pwm mode start count [1] [2] [3] [4] [5] [6] [1] select the counter clock with bits tpsc2 to tpsc0 in tcr. at the same time, select the input clock edge with bits ckeg1 and ckeg0 in tcr. [2] use bits cclr2 to cclr0 in tcr to select the tgr to be used as the tcnt clearing source. [3] use tior to designate the tgr as an output compare register, and select the initial value and output value. [4] set the cycle in the tgr selected in [2], and set the duty in the other tgr. [5] select the pwm mode with bits md3 to md0 in tmdr. [6] set the cst bit in tstr to 1 to start the count operation. figure 18.20 example of pwm mode setting procedure examples of pwm mode operation: figure 18.21 shows an example of pwm mode 1 operation. in this example, tgra compare match is set as the tcnt clearing source, 0 is set for the tgra initial output value and output value, and 1 is set as the tgrb output value. in this case, the value set in tgra is used as the period, and the values set in the tgrb registers are used as the duty cycle. tcnt value tgra h'0000 tioca time tgrb counter cleared by tgra compare match figure 18.21 example of pwm mode operation (1)
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 579 of 982 rej09b0023-0400 figure 18.22 shows an example of pwm mode 2 operation. in this example, synchronous operation is designated for channels 0 and 1, tgrb_1 compare match is set as the tcnt clearing source, and 0 is set for the initial output value and 1 for the output value of the other tgr registers (tgra_0 to tgrd_0, tgra_1), outputting a 5-phase pwm waveform. in this case, the value set in tgrb_1 is used as th e cycle, and the values set in the other tgrs are used as the duty levels. tcnt value tgrb_1 h'0000 tioc0a counter cleared by tgrb_1 compare match time tgra_1 tgrd_0 tgrc_0 tgrb_0 tgra_0 tioc0b tioc0c tioc0d tioc1a figure 18.22 example of pwm mode operation (2)
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 580 of 982 rej09b0023-0400 figure 18.23 shows examples of pwm waveform output with 0% duty cycle and 100% duty cycle in pwm mode. tcnt value tgra h'0000 tioca time tgrb 0% duty cycle tgrb rewritten tgrb rewritten tgrb rewritten tcnt value tgra h'0000 tioca time tgrb 100% duty cycle tgrb rewritten tgrb rewritten tgrb rewritten output does not change when cycle register and duty register compare matches occur simultaneously tcnt value tgra h'0000 tioca time tgrb 100% duty cycle tgrb rewritten tgrb rewritten tgrb rewritten output does not change when cycle register and duty register compare matches occur simultaneously 0% duty cycle figure 18.23 example of pwm mode operation (3)
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 581 of 982 rej09b0023-0400 18.4.6 phase counting mode in phase counting mode, the phase difference betw een two external clock inputs is detected and tcnt counts up or down accordingly. this mode can be set for channels 1 and 2. when phase counting mode is set, an external cl ock is selected as the counter input clock and tcnt operates as an up/down-counter regardless of the setting of bits tpsc0 to tpsc2 and bits ckeg0 and ckeg1 in tcr. however, the functions of bits cclr0 and cclr1 in tcr, and of tior, tier, and tgr, are valid, and input capture/compare match and interrupt functions can be used. this can be used for two-phase encoder pulse input. if overflow occurs when tcnt is counting up, the tcfv flag in tsr is set; if underflow occurs when tcnt is counting down, the tcfu flag is set. the tcfd bit in tsr is the count direction flag. reading the tcfd flag reveals whether tcnt is counting up or down. table 18.32 shows the correspondence between external clock pins and channels. table 18.32 phase counting mode clock input pins external clock pins channels a-phase b-phase when channel 1 is set to phase counting mode tclka tclkb when channel 2 is set to phase counting mode tclkc tclkd
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 582 of 982 rej09b0023-0400 example of phase counting mode setting procedure: figure 18.24 shows an example of the phase counting mode setting procedure. phase counting mode select phase counting mode start count [1] [2] [1] select phase counting mode with bits md3 to md0 in tmdr. [2] set the cst bit in tstr to 1 to start the count operation. figure 18.24 example of phase counting mode setting procedure examples of phase counting mode operation: in phase counting mode, tcnt counts up or down according to the phase difference between two external clocks. there are four modes, according to the count conditions. ? phase counting mode 1 figure 18.25 shows an example of phase counting mode 1 operation, and table 18.33 summarizes the tcnt up/down-count conditions. tcnt value time tclka (channel 1) tclkc (channel 2) tclkb (channel 1) tclkd (channel 2) up-count down-count figure 18.25 example of phase counting mode 1 operation
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 583 of 982 rej09b0023-0400 table 18.33 up/down-count condit ions in phase counting mode 1 tclka (channel 1) tclkc (channel 2) tclkb (channel 1) tclkd (channel 2) operation high level up-count low level low level high level high level down-count low level high level low level [legend] : rising edge : falling edge ? phase counting mode 2 figure 18.26 shows an example of phase counting mode 2 operation, and table 18.34 summarizes the tcnt up/down-count conditions. time down-count up-count tcnt value tclka (channel 1) tclkc (channel 2) tclkb (channel 1) tclkd (channel 2) figure 18.26 example of phase counting mode 2 operation
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 584 of 982 rej09b0023-0400 table 18.34 up/down-count condit ions in phase counting mode 2 tclka (channel 1) tclkc (channel 2) tclkb (channel 1) tclkd (channel 2) operation high level don't care low level don't care low level don't care high level up-count high level don't care low level don't care high level don't care low level down-count [legend] : rising edge : falling edge ? phase counting mode 3 figure 18.27 shows an example of phase counting mode 3 operation, and table 18.35 summarizes the tcnt up/down-count conditions. time up-count down-count tcnt value tclka (channel 1) tclkc (channel 2) tclkb (channel 1) tclkd (channel 2) figure 18.27 example of phase counting mode 3 operation
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 585 of 982 rej09b0023-0400 table 18.35 up/down-count condit ions in phase counting mode 3 tclka (channel 1) tclkc (channel 2) tclkb (channel 1) tclkd (channel 2) operation high level don't care low level don't care low level don't care high level up-count high level down-count low level don't care high level don't care low level don't care [legend] : rising edge : falling edge ? phase counting mode 4 figure 18.28 shows an example of phase counting mode 4 operation, and table 18.36 summarizes the tcnt up/down-count conditions. time up-count down-count tcnt value tclka (channel 1) tclkc (channel 2) tclkb (channel 1) tclkd (channel 2) figure 18.28 example of phase counting mode 4 operation
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 586 of 982 rej09b0023-0400 table 18.36 up/down-count condit ions in phase counting mode 4 tclka (channel 1) tclkc (channel 2) tclkb (channel 1) tclkd (channel 2) operation high level up-count low level low level don't care high level high level down-count low level high level don't care low level [legend] : rising edge : falling edge phase counting mode application example: figure 18.29 shows an example in which channel 1 is in phase counting mode, and channel 1 is coupled with channel 0 to input servo motor 2-phase encoder pulses in order to detect position or speed. channel 1 is set to phase counting mode 1, and the encoder pulse a-phase and b-phase are input to tclka and tclkb. channel 0 operates with tcnt counter clearing by tgrc_0 compare match; tgra_0 and tgrc_0 are used for the compare match function an d are set with the speed control period and position control period. tgrb_0 is used for input capture, with tgrb_0 and tgrd_0 operating in buffer mode. the channel 1 counter input clock is designated as the tgrb_0 input capture source, and the pulse widths of 2-phase encoder 4-multiplication pulses are detected. tgra_1 and tgrb_1 for channel 1 are designated for input capture, and channel 0 tgra_0 and tgrc_0 compare matches are selected as the inpu t capture source and store the up/down-counter values for the control periods. this procedure enables the accurate detection of position and speed.
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 587 of 982 rej09b0023-0400 tcnt_1 tcnt_0 channel 1 tgra_1 (speed period capture) tgra_0 (speed control period) tgrb_1 (position period capture) tgrc_0 (position control period) tgrb_0 (pulse width capture) tgrd_0 (buffer operation) channel 0 tclka tclkb edge detection circuit + - + - figure 18.29 phase counting mode application example
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 588 of 982 rej09b0023-0400 18.4.7 reset-synchronized pwm mode in the reset-synchronized pwm mode, three-phase output of positive and negative pwm waveforms that share a common wave transition point can be obtained by combining channels 3 and 4. when set for reset-synchronized pwm mode, the tioc3b, tioc3d, tioc4a, tioc4c, tioc4b, and tioc4d pins function as pwm output pins and tcnt3 functions as an upcounter. table 18.37 shows the pwm output pins used. table 18.38 shows the settings of the registers. table 18.37 output pins for reset-synchronized pwm mode channel output pin description 3 tioc3b pwm output pin 1 tioc3d pwm output pin 1' (negativ e-phase waveform of pwm output 1) 4 tioc4a pwm output pin 2 tioc4c pwm output pin 2' (negativ e-phase waveform of pwm output 2) tioc4b pwm output pin 3 tioc4d pwm output pin 3' (negativ e-phase waveform of pwm output 3) table 18.38 register settings fo r reset-synchronized pwm mode register description of setting tcnt_3 initial setting of h'0000 tcnt_4 initial setting of h'0000 tgra_3 set count cycle for tcnt_3 tgrb_3 sets the turning point for pwm wavefo rm output by the tioc3b and tioc3d pins tgra_4 sets the turning point for pwm wavefo rm output by the tioc4a and tioc4c pins tgrb_4 sets the turning point for pwm wavefo rm output by the tioc4b and tioc4d pins
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 589 of 982 rej09b0023-0400 procedure for selecting the reset-synchronized pwm mode: figure 18.30 shows an example of procedure for selecting the reset synchronized pwm mode. 7 1 2 3 4 stop counting select counter clock and counter clear source set tgr reset-synchronized pwm mode brushless dc motor control setting set tcnt 5 enable waveform output set reset-synchronized pwm mode 6 pwm cycle output enabling, pwm output level setting 8 start count operation 9 reset-synchronized pwm mode clear the cst3 and cst4 bits in the tstr to 0 to halt the counting of tcnt. the reset-synchronized pwm mode must be set up while tcnt_3 and tcnt_4 are halted. set bits tpsc2 to tpsc0 and ckeg1 and ckeg0 in the tcr_3 to select the counter clock and clock edge for channel 3. set bits cclr2 to cclr0 in the tcr_3 to select tgra compare- match as a counter clear source. when performing brushless dc motor control, set bit bdc in the timer gate control register (tgcr) and set the feedback signal input source and output chopping or gate signal direct output. reset tcnt_3 and tcnt_4 to h'0000. tgra_3 is the period register. set the waveform period value in tgra_3. set the transition timing of the pwm output waveforms in tgrb_3, tgra_4, and tgrb_4. set times within the compare-match range of tcnt_3. x tgra_3 (x: set value). select enabling/disabling of toggle output synchronized with the pmw cycle using bit psye in the timer output control register (tocr), and set the pwm output level with bits olsp and olsn. set bits md3 to md0 in tmdr_3 to b'1000 to select the reset- synchronized pwm mode. tioc3a, tioc3b, tioc3d, tioc4a, tioc4b, tioc4c and tioc4d function as pwm output pins. do not set to tmdr_4. set the enabling/disabling of the pwm waveform output pin in toer. set the cst3 bit in the tstr to 1 to start the count operation. 1 2 3 4 5 7 6 8 9 the output waveform starts toggle operation at the point of tcnt_3 = tgra_3 = x by setting x = tgra, i.e., cycle = duty. notes: * figure 18.30 procedure for selecting the reset-synchronized pwm mode
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 590 of 982 rej09b0023-0400 reset-synchronized pwm mode operation: figure 18.31 shows an example of operation in the reset-synchronized pwm mode. tcnt_3 and tcnt_4 operate as upcounters. the counter is cleared when a tcnt_3 and tgra_3 compare-match occurs, and then begins counting up from h'0000. the pwm output pin output toggles w ith each occurrence of a tgrb_3, tgra_4, tgrb_4 compare-match, a nd upon counter clears. tgra_3 tgrb_3 tgrb_4 h'0000 tgra_4 tioc3b tioc3d tioc4a tioc4c tioc4b tioc4d time tcnt3 and tcnt4 values figure 18.31 reset-synchronized pwm mode operation example (when the tocr's olsn = 1 and olsp = 1)
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 591 of 982 rej09b0023-0400 18.4.8 complementary pwm mode in the complementary pwm mode, three-phase output of non-overlapping positive and negative pwm waveforms can be obtained by combining channels 3 and 4. in complementary pwm mode, tioc3b, tioc3d, tioc4a, tioc4b, tioc4c, and tioc4d pins function as pwm output pins, the tioc3a pin can be set for toggle output synchronized with the pwm period. tcnt_3 and tcnt_4 func tion as increment/decrement counters. table 18.39 shows the pwm output pins used. table 18.40 shows the settings of the registers used. a function to directly cut off the pwm output by using an external signal is supported as a port function. table 18.39 output pins fo r complementary pwm mode channel output pin description 3 tioc3b pwm output pin 1 tioc3d pwm output pin 1' (non-overlapping negative-phase waveform of pwm output 1) 4 tioc4a pwm output pin 2 tioc4b pwm output pin 3 tioc4c pwm output pin 2' (non-overlapping negative-phase waveform of pwm output 2) tioc4d pwm output pin 3' (non-overlapping negative-phase waveform of pwm output 3)
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 592 of 982 rej09b0023-0400 table 18.40 register settings for complementary pwm mode channel counter/register descri ption read/write from cpu 3 tcnt_3 start of up-count from value set in dead time register maskable by pte/pemturwe setting* tgra_3 set tcnt_3 upper limit value (1/2 carrier cycle + dead time) maskable by pte/pemturwe setting* tgrb_3 pwm output 1 compare register maskable by pte/pemturwe setting* tgrc_3 tgra_3 buffer register always readable/writable tgrd_3 pwm output 1/tgrb_3 buffer register always readable/writable 4 tcnt_4 up-count start, initialized to h'0000 maskable by pte/pemturwe setting* tgra_4 pwm output 2 compare register maskable by pte/pemturwe setting* tgrb_4 pwm output 3 compare register maskable by pte/pemturwe setting* tgrc_4 pwm output 2/tgra_4 buffer register always readable/writable tgrd_4 pwm output 3/tgrb_4 buffer register always readable/writable timer dead time data register (tddr) set tcnt_4 and tcnt_3 offset value (dead time value) maskable by pte/pemturwe setting* timer cycle data register (tcdr) set tcnt_4 upper limit value (1/2 carrier cycle) maskable by pte/pemturwe setting* timer cycle buffer register (tcbr) tcdr buffer register always readable/writable subcounter (tcnts) subcounter for dead time generation read-only temporary register 1 (temp1) pwm output 1/tgrb_3 temporary register not readable/writable temporary register 2 (temp2) pwm output 2/tgra_4 temporary register not readable/writable temporary register 3 (temp3) pwm output 3/tgrb_4 temporary register not readable/writable note: * access can be enabled or disabled according to the setting of bit 0 (mturwe) in pte/pemturwe (port e/port e mtu r/w enable register).
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 593 of 982 rej09b0023-0400 tgrc_3 tddr tcnt_3 tgrd_3 tgrd_4 tgrc_4 tgrb_3 temp 1 tgra_4 temp 2 tgrb_4 temp 3 tcnts tcnt_4 tgra_3 tcdr tcbr comparator comparator match signal match signal output controller output protection circuit pwm cycle output pwm output 1 pwm output 2 pwm output 3 pwm output 4 pwm output 5 pwm output 6 poe0 poe1 poe2 poe3 external cutoff input external cutoff interrupt : registers that can always be read or written from the cpu : registers that cannot be read or written from the cpu (except for tcnts, which can only be read) : registers that can be read or written from the cpu (but for which access disabling can be set by port e) tgra_3 compare- match interrupt tcnt_4 underflow interrupt figure 18.32 block diagram of channels 3 and 4 in complementary pwm mode
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 594 of 982 rej09b0023-0400 example of complementary pwm mode setting procedure an example of the complementary pwm mode se tting procedure is shown in figure 18.33. complementary pwm mode stop count operation counter clock, counter clear source selection brushless dc motor control setting tcnt setting inter-channel synchronization setting tgr setting dead time, carrier cycle setting pwm cycle output enabling, pwm output level setting complementary pwm mode setting 3 enable waveform output start count operation 2 4 5 6 7 8 9 10 11 1 3 2 4 5 6 7 8 9 10 11 1 clear bits cst3 and cst4 in the timer start register (tstr) to 0, and halt timer counter (tcnt) operation. perform complementary pwm mode setting when tcnt_3 and tcnt_4 are stopped. set the same counter clock and clock edge for channels 3 and 4 with bits tpsc2 to tpsc0 and bits ckeg1 and ckeg0 in the timer control register (tcr). use bits cclr2 to cclr0 to set synchronous clearing only when restarting by a synchronous clear from another channel during complementary pwm mode operation. when performing brushless dc motor control, set bit bdc in the timer gate control register (tgcr) and set the feedback signal input source and output chopping or gate signal direct output. set the dead time in tcnt_3. set tcnt_4 to h'0000. set only when restarting by a synchronous clear from another channel during complementary pwm mode operation. in this case, synchronize the channel generating the synchronous clear with channels 3 and 4 using the timer synchro register (tsyr). set the output pwm duty in the duty registers (tgrb_3, tgra_4, tgrb_4) and buffer registers (tgrd_3, tgrc_4, tgrd_4). set the same initial value in each corresponding tgr. set the dead time in the dead time register (tddr), 1/2 the carrier cycle in the carrier cycle data register (tcdr) and carrier cycle buffer register (tcbr), and 1/2 the carrier cycle plus the dead time in tgra_3 and tgrc_3. select enabling/disabling of toggle output synchronized with the pwm cycle using bit psye in the timer output control register (tocr), and set the pwm output level with bits olsp and olsn. select complementary pwm mode in timer mode register 3 (tmdr_3). pins tioc3a, tioc3b, tioc3d, tioc4a, tioc4b, tioc4c, and tioc4d function as output pins. do not set in tmdr_4. set enabling/disabling of pwm waveform output pin output in the timer output master enable register (toer). set bits cst3 and cst4 in tstr to 1 simultaneously to start the count operation. figure 18.33 example of complementary pwm mode setting procedure
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 595 of 982 rej09b0023-0400 outline of complementary pwm mode operation in complementary pwm mode, 6-phase pwm output is possible. figure 18.34 illustrates counter operation in complementary pwm mode, and figure 18.35 shows an example of complementary pwm mode operation. counter operation: in complementary pwm mode, three counters ? tcnt_3, tcnt_4, and tcnts ? perform up/down-count operations. tcnt_3 is automatically initialized to the value set in tddr when complementary pwm mode is selected and the cst bit in tstr is 0. when the cst bit is set to 1, tcnt_3 counts up to the value set in tgra_3, then switches to down-counting when it matches tgra_3. when the tcnt3 value matches tddr, the counter switches to up-counting, and the operation is repeated in this way. tcnt_4 is initialized to h'0000. when the cst bit is set to 1, tcnt4 counts up in synchronization with tcnt_3, and switches to down-counting when it matches tcdr. on r eaching h'0000, tcnt4 switc hes to up-counting, and the operation is re peated in this way. tcnts is a read-only counter. it need not be initialized. when tcnt_3 matches tcdr during tcnt_3 and tcnt_4 up/down-counting, down-counting is started, and when tcnts matches tcdr, th e operation switches to up-counting. when tcnts matches tgra_3, it is cleared to h'0000. when tcnt_4 matches tddr during tcnt_3 and tcnt_4 down-counting, up-counting is started, and when tcnts matches tddr, the operation switches to down-counting. when tcnts reaches h'0000, it is set with the value in tgra_3. tcnts is compared with the compare register and temporary register in which the pwm duty is set during the count operation only.
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 596 of 982 rej09b0023-0400 counter value tgra_3 tcdr tddr h'0000 tcnt_4 tcnts tcnt_3 tcnt_3 tcnt_4 tcnts time figure 18.34 complementary pwm mode counter operation register operation: in complementary pwm mode, nine registers are used, comprising compare registers, buffer registers, and temporary registers. figure 18.35 shows an example of complementary pwm mode operation. the registers which are constantly compared with the counters to perform pwm output are tgrb_3, tgra_4, and tgrb_4. when these registers match the counter, the value set in bits olsn and olsp in the timer output control register (tocr) is output. the buffer registers for th ese compare registers are tgrd_3, tgrc_4, and tgrd_4. between a buffer register and compare register there is a temporary register. the temporary registers cannot be accessed by the cpu. data in a compare register is changed by writing the new data to the corresponding buffer register. the buffer registers can be read or written at any time. the data written to a buffer register is constantly transferred to the tempor ary register in the ta interval. data is not transferred to the temporary register in the tb interval. data written to a buffer register in this interval is transferred to th e temporary register at th e end of the tb interval. the value transferred to a temporary register is transferred to the compare register when tcnts for which the tb interval ends matches tgra_3 when counting up, or h'0000 when counting down. the timing for transfer from the temporary register to the co mpare register can be selected with bits md3 to md0 in the timer mode regist er (tmdr). figure 18.3 5 shows an example in which the mode is selected in which the change is made in the trough. in the tb interval (tb1 in figure 18.35) in whic h data transfer to the temporary register is not performed, the temporary register has the same function as the compare register, and is compared
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 597 of 982 rej09b0023-0400 with the counter. in this interval, therefore, there are two compare match registers for one-phase output, with the compare register containing the pre-change data, and the temporary register containing the new data. in this interval, the three counters ? tcnt_3, tcnt_4, and tcnts ? and two registers ? compare register and temporary register ? are compared, and pwm output controlled accordingly. tgra_3 tcdr tgra_4 tgrc_4 tddr h'0000 buffer register tgrc_4 temporary register temp2 compare register tgra_4 output waveform output waveform tb2 ta tb1 ta tb2 ta tcnt_3 tcnt_4 tcnts (output waveform is active-low) h'6400 h'0080 h'6400 h'6400 h'0080 h'0080 transfer from temporary register to compare register transfer from temporary register to compare register figure 18.35 example of complementary pwm mode operation
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 598 of 982 rej09b0023-0400 initialization: in complementary pwm mode, there are si x registers that must be initialized. before setting complementary pwm mode with bits md3 to md0 in the timer mode register (tmdr), the following initial register values must be set. tgrc_3 operates as the buffer re gister for tgra_3, and should be set with 1/2 the pwm carrier cycle + dead time td. the timer cycle buffer regist er (tcbr) operates as the buffer register for the timer cycle data register (tcdr), and should be set with 1/2 the pwm carrier cycle. set dead time td in the timer dead time data register (tddr). set the respective initial pwm duty values in buffer registers tgrd_3 , tgrc_4, and tgrd_4. the values set in the five buffe r registers excluding tddr are tr ansferred simultaneously to the corresponding compare re gisters when complementary pwm mode is set. set tcnt_4 to h'0000 before setting complementary pwm mode. table 18.41 registers and count ers requiring initialization register/counter set value tgrc_3 1/2 pwm carrier cycle + dead time td tddr dead time td tcbr 1/2 pwm carrier cycle tgrd_3, tgrc_4, tgrd_4 initial pwm duty value for each phase tcnt_4 h'0000 note: the tgrc_3 set value must be the sum of 1/2 the pwm carrier cycle set in tcbr and dead time td set in tddr. pwm output level setting: in complementary pwm mode, the pwm pulse output level is set with bits olsn and olsp in the timer output control register (tocr). the output level can be set for each of the three positive phases and three negative phases of 6- phase output. complementary pwm mode should be cleared before setting or changing output levels.
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 599 of 982 rej09b0023-0400 dead time setting: in complementary pwm mode, pwm pulses are output with a non- overlapping relationship between the positive and negative phases. this non-overlap time is called the dead time. the non-overlap time is set in the timer dead time data register (tddr). the value set in tddr is used as the tcnt_3 counter start value, and creates non-overlap betw een tcnt_3 and tcnt_4. complementary pwm mode should be cleared before changing the contents of tddr. pwm cycle setting: in complementary pwm mode, the pwm pulse cycle is set in two registers ? tgra_3, in which the tcnt_3 upper limit value is set, and tcdr, in which the tcnt_4 upper limit value is set. the settings should be made so as to achieve the following relationship between these two registers: tgra_3 set value = tcdr set value + tddr set value the tgra_3 and tcdr settings are made by setting the values in buffer registers tgrc_3 and tcbr. the values set in tgrc_3 and tcbr ar e transferred simultaneously to tgra_3 and tcdr in accordance with the tran sfer timing selected with bits md3 to md0 in the timer mode register (tmdr). the updated pwm cycle is reflected from the next cy cle when the data update is performed at the crest, and from the cu rrent cycle when performed in the trough. figure 18.36 illustrates the operation when the pwm cycle is updated at the crest. see the following part, register data updating, for the method of updating the data in each buffer register.
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 600 of 982 rej09b0023-0400 counter value tgrc_3 update tgra_3 update tgra_3 tcnt_3 tcnt_4 time figure 18.36 example of pwm cycle updating register data updating: in complementary pwm mode, the buffer register is used to update the data in a compare register. the update data can be written to the buffer register at any time. there are five pwm duty and carrier cycle registers that have buffer registers and can be updated during operation. there is a temporary register between each of these registers and its buffer register. when subcounter tcnts is not counting, if buffer register data is updated, the temporary register value is also rewritten. transfer is not performed from buffer registers to temporary registers when tcnts is counting; in this case, the value written to a buffer register is transferred after tcnts halts. the temporary register value is transferred to th e compare register at the data update timing set with bits md3 to md0 in the timer mode regist er (tmdr). figure 18.3 7 shows an example of data updating in complementary pwm mode. th is example shows the mode in which data updating is performed at both the counter crest and trough. when rewriting buffer register data, a write to tgrd_4 must be performed at the end of the update. data transfer from the buffer registers to the temporary registers is performed simultaneously for all five registers after the write to tgrd_4. a write to tgrd_4 must be performed after writing data to the registers to be updated, even when not updating all five registers, or when updating the tgrd_4 data. in this case, the data written to tgrd_4 should be the same as the data prior to the write operation.
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 601 of 982 rej09b0023-0400 data update timing: counter crest and trough transfer from temporary register to compare register transfer from temporary register to compare register transfer from temporary register to compare register transfer from temporary register to compare register transfer from temporary register to compare register transfer from temporary register to compare register counter value tgra_3 tgrc_4 tgra_4 h'0000 br data1 data2 data3 data4 data5 data6 data1 data1 data2 data3 data4 data6 data2 data3 data4 data5 data6 temp_r gr time : compare register : buffer register figure 18.37 example of data update in complementary pwm mode
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 602 of 982 rej09b0023-0400 initial output in complementary pwm mode: in complementary pwm mode, the initial output is determined by the setting of bits olsn and olsp in the timer output control register (tocr). this initial output is the pwm pulse non-active level, and is output from when complementary pwm mode is set with the timer mode register (tmdr) until tcnt_4 exceeds the value set in the dead time register (tddr) . figure 18.38 shows an example of the initial output in complementary pwm mode. an example of the waveform when the initial pwm duty value is smaller than the tddr value is shown in figure 18.39. timer output control register settings olsn bit: 0 (initial output: high; active level: low) olsp bit: 0 (initial output: high; active level: low) tcnt3, 4 value tgr4_a tddr tcnt_3 tcnt_4 initial output dead time time active level active level tcnt3, 4 count start (tstr setting) complementary pwm mode (tmdr setting) positive phase output negative phase output figure 18.38 example of initial ou tput in complementary pwm mode (1)
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 603 of 982 rej09b0023-0400 timer output control register settings olsn bit: 0 (initial output: high; active level: low) olsp bit: 0 (initial output: high; active level: low) tcnt_3, 4 value tgr_4 tddr tcnt_3 tcnt_4 initial output time active level tcnt_3, 4 count start (tstr setting) complementary pwm mode (tmdr setting) positive phase output negative phase output figure 18.39 example of initial output in complementary pwm mode (2)
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 604 of 982 rej09b0023-0400 complementary pwm mode pwm output generation method: in complementary pwm mode, 3-phase output is performed of pwm waveforms with a non-overlap time between the positive and negative phases. this non- overlap time is called the dead time. a pwm waveform is generated by output of the output level selected in the timer output control register in the event of a compare-match between a counter and data register. while tcnts is counting, data register and temporary register values are simultaneously compared to create consecutive pwm pulses from 0 to 100%. the relative timing of on and off compare-match occurrence may vary, but the comp are-match that turns off each ph ase takes precedence to secure the dead time and ensure that the positive phase and negative phase on times do not overlap. figures 18.40 to 18.42 show examples of waveform generation in complementary pwm mode. the positive phase/negative phase off timing is generated by a compare-match with the solid-line counter, and the on timing by a compare-match with the dotted-line counter operating with a delay of the dead time behind the solid-line counter. in the t1 period, compare-match a that turns off the negative phase has the highest priority, and compare-matches occurring prior to a are ignored. in the t2 period, compare-match c that turns off the positive phase has the highest priority, and compare-matches occurring prior to c are ignored. in normal cases, compare-matches occur in the order a b c d (or c d a ' b '), as shown in figure 18.40. if compare-matches deviate from the a b c d order, since the time for which the negative phase is off is less than twice the dead time, the figure shows the positive phase is not being turned on. if compare-matches deviate from the c d a ' b ' order, since the time for which the positive phase is off is less than twice the dead time, the figure shows the negative phase is not being turned on. if compare-match c occurs first following compare-match a , as shown in figure 18.41, compare- match b is ignored, and the negative phase is turned off by compare-match d . this is because turning off of the positive phase has prior ity due to the occurrence of compare-match c (positive phase off timing) before compare-match b (positive phase on timing) (consequently, the waveform does not change since the positive phase goes from off to off). similarly, in the example in figure 18.42, compare-match a ' with the new data in the temporary register occurs before compare-match c , but other compare-matches occurring up to c , which turns off the positive phase, are ignored. as a result, the positive phase is not turned on. thus, in complementary pwm mode, compare-matches at turn-off timings take precedence, and turn-on timing compare-matches that occur befo re a turn-off timing compare-match are ignored.
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 605 of 982 rej09b0023-0400 t2 period t1 period t1 period ab c a' b' d tgr3a_3 tcdr tddr h'0000 positive phase negative phase figure 18.40 example of complementary pwm mode waveform output (1)
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 606 of 982 rej09b0023-0400 t2 period t1 period t1 period tgra_3 tcdr tddr h'0000 positive phase negative phase c d a a b b figure 18.41 example of complementary pwm mode waveform output (2)
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 607 of 982 rej09b0023-0400 ab c a' b' d t1 period t2 period t1 period tgra_3 tcdr tddr h'0000 positive phase negative phase figure 18.42 example of complementary pwm mode waveform output (3)
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 608 of 982 rej09b0023-0400 complementary pwm mode 0% and 100% duty output: in complementary pwm mode, 0% and 100% duty cycles can be output as required. figures 18.43 to 18.47 show output examples. 100% duty output is performed when the data register value is set to h'0000. the waveform in this case has a positive phase with a 100% on-state. 0% duty output is performed when the data register value is set to the same value as tgra _3. the waveform in this case has a positive phase with a 100% off-state. on and off compare-matches occur simultaneously, but if a turn-on compare-match and turn-off compare-match for the same phase occur simultaneously, both compare-matches are ignored and the waveform does not change. a b c d a' b' t2 period t1 period t1 period tgra_3 tcdr tddr h'0000 positive phase negative phase figure 18.43 example of complementary pwm mode 0% and 100% waveform output (1)
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 609 of 982 rej09b0023-0400 t2 period t1 period t1 period tgra_3 tcdr tddr h'0000 positive phase negative phase a c d a b b figure 18.44 example of complementary pwm mode 0% and 100% waveform output (2) t2 period t1 period t1 period a b c d tgra_3 tcdr tddr h'0000 positive phase negative phase figure 18.45 example of complementary pwm mode 0% and 100% waveform output (3)
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 610 of 982 rej09b0023-0400 tgra_3 tcdr tddr h'0000 positive phase negative phase t2 period t1 period t1 period a b c b' d a' figure 18.46 example of complementary pwm mode 0% and 100% waveform output (4) cad b t2 period t1 period t1 period tgra_3 tcdr tddr h'0000 positive phase negative phase figure 18.47 example of complementary pwm mode 0% and 100% waveform output (5)
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 611 of 982 rej09b0023-0400 toggle output synchronized with pwm cycle: in complementary pwm mode, toggle output can be performed in synchronization with the pwm carrier cycle by setting the psye bit to 1 in the timer output control register (tocr). an example of a toggle output waveform is shown in figure 18.48. this output is toggled by a compare-match between tcnt_3 and tgra_3 and a compare-match between tcnt4 and h'0000. the output pin for this toggle output is the tioc3a pin. the initial output is 1. tgra_3 h'0000 toggle output tioc3a pin tcnt_4 tcnt_3 figure 18.48 example of toggle output waveform synchronized with pwm output
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 612 of 982 rej09b0023-0400 counter clearing by another channel: in complementary pwm mode, by setting a mode for synchronization with another channel by means of the timer synchro register (tsyr), and selecting synchronous clearing with bits cclr2 to cclr0 in the timer control register (tcr), it is possible to have tcnt_3, tcnt_4, and tcnts cleared by another channel. figure 18.49 illustrates the operation. use of this function enables counter clearing and restarting to be performed by means of an external signal. tgra_3 tcdr tddr h'0000 channel 1 input capture a tcnt_1 tcnt_3 tcnt_4 tcnts synchronous counter clearing by channel 1 input capture a figure 18.49 counter clearing sy nchronized with another channel
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 613 of 982 rej09b0023-0400 example of ac synchronous motor (brush less dc motor) drive waveform output: in complementary pwm mode, a brushless dc motor can easily be controlled using the timer gate control register (tgcr). figures 18.50 to 18.53 show examples of brushless dc motor drive waveforms created using tgcr. when output phase switching for a 3-phase brushless dc motor is performed by means of external signals detected with a hall element, etc., clear th e fb bit in tgcr to 0. in this case, the external signals indicating the polarity position are input to channel 0 timer input pins tioc0a, tioc0b, and tioc0c (set with pfc). when an edge is detected at pin tioc0a, tioc0b, or tioc0c, the output on/off state is switched automatically. when the fb bit is 1, the output on/off state is switched when the uf, vf, or wf bit in tgcr is cleared to 0 or set to 1. the drive waveforms are output from the complementary pwm mode 6-phase output pins. with this 6-phase output, in the case of on output, it is possible to use complementary pwm mode output and perform chopping output by setting the n bit or p bit to 1. when the n bit or p bit is 0, level output is selected. the 6-phase output active level (on output level) can be set with the olsn and olsp bits in the timer output control register (tocr) rega rdless of the setting of the n and p bits. external input tioc0a pin tioc0b pin tioc0c pin tioc3b pin tioc3d pin tioc4a pin tioc4c pin tioc4b pin tioc4d pin 6-phase output when bcd = 1, n = 0, p = 0, fb = 0, output active level = high figure 18.50 example of output phase switching by external input (1)
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 614 of 982 rej09b0023-0400 external input tioc0a pin tioc0b pin tioc0c pin tioc3b pin tioc3d pin tioc4a pin tioc4c pin tioc4b pin tioc4d pin 6-phase output when bcd = 1, n = 1, p = 1, fb = 0, output active level = high figure 18.51 example of output phase switching by external input (2) tgcr uf bit vf bit wf bit tioc3b pin tioc3d pin tioc4a pin tioc4c pin tioc4b pin tioc4d pin 6-phase output when bcd = 1, n = 0, p = 0, fb = 1, output active level = high figure 18.52 example of output phase switching by means of uf, vf, wf bit settings (1)
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 615 of 982 rej09b0023-0400 tgcr uf bit vf bit wf bit tioc3b pin tioc3d pin tioc4a pin tioc4c pin tioc4b pin tioc4d pin 6-phase output when bcd = 1, n = 1, p = 1, fb = 1, output active level = high figure 18.53 example of output phase switching by means of uf, vf, wf bit settings (2) a/d conversion start request setting: in complementary pwm mode, an a/d conversion start request can be set using a tgra_3 compare-match or a compare-match on a channel other than channels 3 and 4. when start requests using a tgra_3 compare-match are set, a/d conversion can be started at the center of the pwm pulse. a/d conversion start requests can be set by setting the ttge bit to 1 in the timer interrupt enable register (tier). complementary pwm mode output protection function complementary pwm mode output has the following protection functions. register and counter miswri te prevention function: with the exception of the buffer registers, which can be rewritten at any time, access by the cpu can be enabled or disabled for the mode registers, control registers, compare registers, and counters used in complementary pwm mode by means of bit 0 (mturwe) in pemturwer of the port e (port e mtu r/w enable register).
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 616 of 982 rej09b0023-0400 some registers in channels 3 and 4 concerned are listed below: total 21 registers of tcr_3 and tcr_4; tmdr_3 and tmdr_4; tiorh_3 and tiorh_4; tiorl_3 and tiorl_4; tier_3 and tier_4; tcnt_3 and tcnt_4 ; tgra_3 and tgra_4; tgrb_3 and tgrb_4; toer; tocr; tgcr; tcdr; and tddr. this function enables the cpu to prevent miswriting due to the cpu runaway by disabling cpu access to the mode registers, cont rol register, and counters. in acces s disabled state, an undefined value is read from the registers concerned, and cannot be modified. halting of pwm output by external signal: the 6-phase pwm output pins can be set automatically to the high-impedance state by inpu tting specified external signals. there are four external signal input pins. see section 18.9, port output enable (poe), for details. 18.5 interrupts 18.5.1 interrupts and priority there are three kinds of mtu interrupt source; tgr input capture/compare match, tcnt overflow, and tcnt underflow. each interrupt source has its own status flag and enable/disabled bit, allowing the generation of interrupt request signals to be enabled or disabled individually. when an interrupt request is generated, the corresponding status flag in tsr is set to 1. if the corresponding enable/disable bit in tier is set to 1 at this time, an interrupt is requested. the interrupt request is cleared by cl earing the status flag to 0. relative channel priority can be changed by the in terrupt controller, however the priority within a channel is fixed. table 18.42 lists the mtu interrupt sources.
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 617 of 982 rej09b0023-0400 table 18.42 mtu interrupts channel name interrupt source interrupt flag dma activation priority 0 tgi0a tgra_0 input capture/co mpare match tgfa_0 possible high tgi0b tgrb_0 input capture/com pare match tgfb_0 not possible tgi0c tgrc_0 input capture/comp are match tgfc_0 not possible tgi0d tgrd_0 input capture/comp are match tgfd_0 not possible tci0v tcnt_0 overflow tcfv_0 not possible 1 tgi1a tgra_1 input capture/co mpare match tgfa_1 possible tgi1b tgrb_1 input capture/com pare match tgfb_1 not possible tci1v tcnt_1 overflow tcfv_1 not possible tci1u tcnt_1 underflow tcfu_1 not possible 2 tgi2a tgra_2 input capture/co mpare match tgfa_2 possible tgi2b tgrb_2 input capture/com pare match tgfb_2 not possible tci2v tcnt_2 overflow tcfv_2 not possible tci2u tcnt_2 underflow tcfu_2 not possible 3 tgi3a tgra_3 input capture/co mpare match tgfa_3 possible tgi3b tgrb_3 input capture/com pare match tgfb_3 not possible tgi3c tgrc_3 input capture/comp are match tgfc_3 not possible tgi3d tgrd_3 input capture/comp are match tgfd_3 not possible tci3v tcnt_3 overflow tcfv_3 not possible 4 tgi4a tgra_4 input capture/co mpare match tgfa_4 possible tgi4b tgrb_4 input capture/com pare match tgfb_4 not possible tgi4c tgrc_4 input capture/comp are match tgfc_4 not possible tgi4d tgrd_4 input capture/comp are match tgfd_4 not possible tci4v tcnt_4 overflow/underflow tcfv_4 not possible low note: this table shows the initial state immediately after a reset. the relative channel priority can be changed by the interrupt controller. input capture/compar e match interrupt: an interrupt is requested if the tgie bit in tier is set to 1 when the tgf flag in tsr is set to 1 by the occurrence of a tg r input capture/compare match on a particular channel. the interrupt reques t is cleared by clearing the tgf flag to 0. the mtu has 16 input capture/compare match interrupts , four each for channels 0, 3, and 4, and two each for channels 1 and 2.
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 618 of 982 rej09b0023-0400 overflow interrupt: an interrupt is requested if the tciev bit in tier is set to 1 when the tcfv flag in tsr is set to 1 by the occurrence of tcnt overflow on a channel. the interrupt request is cleared by clearing th e tcfv flag to 0. the mtu has five overflow interrupts, one for each channel. underflow interrupt: an interrupt is requested if the tcieu bit in tier is set to 1 when the tcfu flag in tsr is set to 1 by the occurrence of tcnt underflow on a channel. the interrupt request is cleared by clearing the tcfu flag to 0. the mtu has four underflow interrupts, one each for channels 1 and 2. 18.5.2 dma activation the dma can be activated by a tgra input capture /compare match interrupt in each channel. if the tgfasel bit in tier is set to 1 when the tgfa flag in tsr is set to 1 due to the tgra input capture/compare match in each channel, the dma transfer is requested to dma. for details, see section 13, direct memo ry access controller (dmac). a total of five mtu input capture/compare match interrupts can be used as dma activation sources for each channel when using dma, do not clear the flag by writing 0 after reading tgfa = 1. the flag can be automatically cleared by dma ha rdware. however, if a dma address error occurs during a dma read cycle, the flag must be cleared using software by writ ing 0 after reading tgfa = 1. 18.5.3 a/d converter activation the a/d converter can be activat ed by the tgra input capture/compare match in each channel. if the ttge bit in tier is set to 1 when the tgfa flag in tsr is set to 1 by the occurrence of a tgra input capture/compare match on a particular channel, a request to start a/d conversion is sent to the a/d converter. if the mtu conversion start trigger has been selected on the a/d converter at this time, a/d conversion starts. in the mtu, a total of five tgra input capture/compare match interrupts can be used as a/d converter conversion start sour ces, one for each channel.
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 619 of 982 rej09b0023-0400 18.6 operation timing 18.6.1 input/output timing tcnt count timing: figure 18.54 shows tcnt count timing in internal clock operation, and figure 18.55 shows tcnt count timing in external clock operation (normal mode), and figure 18.56 shows tcnt count timing in external clock operation (phase counting mode). tcnt tcnt input clock internal clock p n-1 n n+1 n+2 falling edge rising edge figure 18.54 count timing in internal clock operation tcnt tcnt input clock external clock p n-1 n n+1 n+2 falling edge rising edge falling edge figure 18.55 count timing in external clock operation
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 620 of 982 rej09b0023-0400 p external clock tcnt input clock tcnt falling edge falling edge rising edge n-1 n n+1 figure 18.56 count timing in external clock operation (phase counting mode) output compare output timing: a compare match signal is generated in the final state in which tcnt and tgr match (the point at which the count value matched by tcnt is updated). when a compare match signal is generated, the output value set in tior is output at the output compare output pin (tioc pin). after a match between tcnt and tgr, the compare match signal is not generated until the tcnt input clock is generated. figure 18.57 shows output compare output timing (normal mode and pwm mode) and figure 18.58 shows output compare output timing (complementary pwm mode and reset synchronous pwm mode). tgr tcnt tcnt input clock n n n+1 compare match signal tioc pin p figure 18.57 output compare output timing (normal mode/pwm mode)
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 621 of 982 rej09b0023-0400 p tcnt input clock tcnt n n+1 tgr compare match signal tioc pin n figure 18.58 output compare output timing (complementary pwm mode/res et synchronous pwm mode) input capture si gnal timing: figure 18.59 shows input capture signal timing. tcnt input capture input n n+1 n+2 n n+2 tgr input capture signal p figure 18.59 input capture input signal timing
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 622 of 982 rej09b0023-0400 timing for counter clearing by compare match/input capture: figure 18.60 shows the timing when counter clearing on compare match is specified, and figure 18.61 shows the timing when counter clearing on input capture is specified. tcnt counter clear signal compare match signal tgr n n h'0000 p figure 18.60 counter clea r timing (compare match) tcnt counter clear signal input capture signal tgr n h'0000 n p figure 18.61 counter clea r timing (input capture)
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 623 of 982 rej09b0023-0400 buffer operation timing: figures 18.62 and 18.63 show the timing in buffer operation. tgra, tgrb compare match signal tcnt tgrc, tgrd n n n n n+1 p figure 18.62 buffer operat ion timing (compare match) tgra, tgrb tcnt input capture signal tgrc, tgrd n n n n+1 n n n+1 p figure 18.63 buffer operation timing (input capture)
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 624 of 982 rej09b0023-0400 18.6.2 interrupt signal timing tgf flag setting timing in case of compare match: figure 18.64 shows the timing for setting of the tgf flag in tsr on compare match, and tgi interrupt request signal timing. tgr tcnt tcnt input clock n n n+1 compare match signal tgf flag tgi interrupt p figure 18.64 tgi interrupt timing (compare match) tgf flag setting timing in case of input capture: figure 18.65 shows the timing for setting of the tgf flag in tsr on input capture, and tgi interrupt request signal timing. tgr tcnt input capture signal n n tgf flag tgi interrupt p figure 18.65 tgi interrupt timing (input capture)
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 625 of 982 rej09b0023-0400 tcfv flag/tcfu flag setting timing: figure 18.66 shows the timing for setting of the tcfv flag in tsr on overflow, and tciv interrupt request signal timing. figure 18.67 shows the timing for setting of the tcfu flag in tsr on underflow, and tciu interrupt request signal timing. overflow signal tcnt (overflow) tcnt input clock h'ffff h'0000 tcfv flag tciv interrupt p figure 18.66 tciv in terrupt setting timing underflow signal tcnt (underflow) tcnt input clock h'0000 h'ffff tcfu flag tciu interrupt p figure 18.67 tciu in terrupt setting timing
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 626 of 982 rej09b0023-0400 status flag clearing timing: after a status flag is read as 1 by the cpu, it is cleared by writing 0 to it. when the dma is activated, the flag is cleared automatically. figure 18.68 shows the timing for status flag clearing by the cpu, and figure 18.69 shows the timing for status flag clearing by the dma. status flag write signal address tsr address interrupt request signal tsr write cycle t1 t2 p figure 18.68 timing for stat us flag clearing by the cpu dma transfer request signal status falg dma falg clear signal p figure 18.69 timing for status flag clearing by dma activation
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 627 of 982 rej09b0023-0400 18.7 usage notes 18.7.1 module standby mode setting mtu operation can be disabled or enabled using the module standby register. 18.7.2 input clock restrictions the input clock pulse width must be at least 1.5 st ates in the case of single-edge detection, and at least 2.5 states in the case of both-edge detecti on. the tpu will not operat e properly at narrower pulse widths. in phase counting mode, the phase difference and ove rlap between the two inpu t clocks must be at least 1.5 states, and the pulse width must be at least 2.5 states. figure 18.70 shows the input clock conditions in phase counting mode. overlap phase differ- ence phase differ- ence overlap tclka (tclkc) tclkb (tclkd) pulse width pulse width pulse width pulse width notes: phase difference and overlap pulse width : 1.5 states or more : 2.5 states or more figure 18.70 phase difference, overlap, and pulse width in phase counting mode
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 628 of 982 rej09b0023-0400 18.7.3 caution on period setting when counter clearing on compare match is set, tcnt is cleared in the final state in which it matches the tgr value (the point at which the count value matched by tcnt is updated). consequently, the actual counter frequency is given by the following formula: f = p (n + 1) where f : counter frequency p : peripheral clock operating frequency n : tgr set value 18.7.4 conflict between tcnt write and clear operations if the counter clear signal is generated in the t2 state of a tcnt write cycle, tcnt clearing takes precedence and the tcnt write is not performed. figure 18.71 shows the timing in this case. counter clear signal write signal address p tcnt address tcnt tcnt write cycle t1 t2 n h'0000 figure 18.71 conflict between tc nt write and clear operations
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 629 of 982 rej09b0023-0400 18.7.5 conflict between tcnt wr ite and increment operations if incrementing occurs in the t2 state of a tcnt write cycle, the tcnt write takes precedence and tcnt is not incremented. figure 18.72 shows the timing in this case. tcnt input clock write signal address p tcnt address tcnt tcnt write cycle t1 t2 nm tcnt write data figure 18.72 conflict between tcnt write and increment operations
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 630 of 982 rej09b0023-0400 18.7.6 conflict between tg r write and compare match when a compare match occurs in the t2 state of a tgr write cycle, the tgr write is executed and the compare match signal is generated. figure 18.73 shows the timing in this case. compare match signal write signal address p tgr address tcnt tgr write cycle t1 t2 nm tgr write data tgr n n+1 figure 18.73 conflict between tgr write and compare match 18.7.7 conflict between buffer re gister write and compare match if a compare match occurs in the t1 state of a tgr write cycle, the data that is transferred to tgr by the buffer operation differs depending on channel 0 and channels 3 and 4: data on channel 0 is that after write, and on channels 3 and 4, before write. figures 18.74 and 18.75 show the timing in this case.
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 631 of 982 rej09b0023-0400 compare match buffer signal compare match signal write signal address p buffer register address buffer register tgr write cycle t1 t2 m tgr n m buffer register write data figure 18.74 conflict between buffer register write and compare match (channel 0) p address write signal compare match signal compare match buffer signal tgr write cycle t1 t2 buffer register address n n m buffer register write data buffer register tgr figure 18.75 conflict between buff er register write and compare match (channels 3 and 4)
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 632 of 982 rej09b0023-0400 18.7.8 conflict between tg r read and input capture if an input capture signal is generated in the t2 stat e of a tgr read cycle, the data that is read will be that in the buffer after input capture transfer. figure 18.76 shows the timing in this case. input capture signal read signal address p tgr tcnt buffer register read cycle t1 t2 m n n buffer register m buffer register address figure 18.76 conflict between tgr read and input capture
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 633 of 982 rej09b0023-0400 18.7.9 conflict between tg r write and input capture if an input capture signal is generated in the t2 state of a tgr write cycle, the input capture operation takes precedence and the wr ite to tgr is not performed. figure 18.77 shows the timing in this case. input capture signal write signal address p tcnt tgr write cycle t1 t2 m tgr m tgr address figure 18.77 conflict between tgr write and input capture
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 634 of 982 rej09b0023-0400 18.7.10 conflict between buffer re gister write and input capture if an input capture signal is generated in the t2 st ate of a buffer register write cycle, the buffer operation takes precedence and the write to the buffer register is not performed. figure 18.78 shows the timing in this case. input capture signal write signal address p tcnt buffer register write cycle t1 t2 n tgr n m m buffer register buffer register address figure 18.78 conflict between bu ffer register write and input capture 18.7.11 tcnt2 write and overflow/unde rflow conflict in cascade connection with timer counters tcnt1 and tcnt2 in a cascad e connection, when a conflict occurs during tcnt_1 count (during a tcnt_2 overflow/underflow) in the t 2 state of the tcnt_2 write cycle, the write to tcnt_2 is conducted, and the tcnt_1 count signal is disabled. at this point, if there is match with tgra_1 and the tcnt_1 value, a compare signal is issued. furthermore, when the tcnt_1 count clock is selected as the input cap ture source of channel 0, tgra_0 to d_0 carry out the input capture operation. in addition, when the compare match/input capture is selected as the input capture source of tgrb_1, tgrb_1 carri es out input capture operation. the timing is shown in figure 18.79. for cascade connections, be sure to synchronize settings for channels 1 and 2 when setting tcnt clearing.
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 635 of 982 rej09b0023-0400 t1 t2 h'fffe h'ffff n n + 1 h'ffff m m n p qp m disabled tcnt_2 write data tcnt_2 address tcnt write cycle p address write signal tcnt_2 tgr2a_2 to tgr2b_2 ch2 compare- match signal a/b tcnt_1 input clock tcnt_1 tgra_1 ch1 compare- match signal a tgrb_1 ch1 input capture signal b tcnt_0 tgra_0 to tgrd_0 ch0 input capture signal a to d figure 18.79 tcnt_2 write and overflow/u nderflow conflict with cascade connection
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 636 of 982 rej09b0023-0400 18.7.12 counter value during co mplementary pwm mode stop when counting operation is stopped with tcnt_3 and tcnt_4 in complementary pwm mode, tcnt_3 has the timer dead time register (tddr) value, and tcnt_4 is set to h'0000. when restarting complementary pwm mode, counting begins automatically from the initialized state. this explanatory diagram is shown in figure 18.80. when counting begins in another operating mode, be sure that tcnt_3 and tcnt_4 are set to the initial values. tgra_3 tcdr tddr h'0000 tcnt_3 tcnt_4 complementary pwm mode operation complementary pwm mode operation counter operation stop complementary pmw restart figure 18.80 counter value during complementary pwm mode stop 18.7.13 buffer operation setting in complementary pwm mode in complementary pwm mode, conduct rewrites by buffer operation for the pwm cycle setting register (tgra_3), timer cycle data register (tcdr), and duty setting registers (tgrb_3, trga_4, and tgrb_4). in complementary pwm mode, channel 3 and chan nel 4 buffers operate in accordance with bit settings bfa and bfb of tmdr_3. when tmdr_3's bfa bit is set to 1, tgrc_3 functions as a
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 637 of 982 rej09b0023-0400 buffer register for tgra_3. at the same time, tgrc_4 functions as the buffer register for trga_4, while the tcbr functions as the tcdr's buffer register. 18.7.14 reset sync pwm mode buffer operation and compare match flag when setting buffer operation for reset sync pw m mode, set the bfa and bfb bits of tmdr_4 to 0. the tioc4c pin will be unable to produce its waveform output if the bfa bit of tmdr_4 is set to 1. in reset sync pwm mode, the channel 3 and channel 4 buffers operate in accordance with the bfa and bfb bit settings of tmdr_3. for example, if the bfa bit of tmdr_3 is set to 1, tgrc_3 functions as the buffer register for tgra_3. at the same time, tgrc_4 functions as the buffer register for trga_4. the tgfc bit and tgfd bit of tsr_3 and tsr_4 are not set when tgrc_3 and tgrd_3 are operating as buffer registers. figure 18.81 shows an example of operations for tgr_3, tgr_4, tioc3, and tioc4, with tmdr_3's bfa and bfb bits set to 1, and tmdr_4's bfa and bfb bits set to 0. tgra_3 tgrc_3 tgrb_3, tgra_4, tgrb_4 tgrd_3, tgrc_4, tgrd_4 h'0000 tioc3a tioc3b tioc3d tioc4a tioc4c tioc4b tioc4d tgfc tgfd tgra_3, tgrc_3 tgrb_3, tgrd_3, tgra_4, tgrc_4, tgrb_4, tgrd_4 buffer transfer with compare match a3 tcnt3 not set not set point a point b figure 18.81 buffer operation and compa re-match flags in reset sync pwm mode
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 638 of 982 rej09b0023-0400 18.7.15 overflow flags in reset sync pwm mode when set to reset sync pwm mode, tcnt_3 and tcnt_4 start counting when the cst3 bit of tstr is set to 1. at this point, tcnt_4's count clock source and count edge obey the tcr_3 setting. in reset sync pwm mode, with cycle register tgra_3's set value at h'ffff, when specifying tgr3a compare-match for the count er clear source, tcnt_3 and tcnt_4 count up to h'ffff, then a compare-match occurs with tgra_3, and tcnt_3 and tcnt_4 are both cleared. at this point, tsr's overflow flag tcfv bit is not set. figure 18.82 shows a tcfv bit operation example in reset sync pwm mode with a set value for cycle register tgra_3 of h'ffff, when a tgra _3 compare-match has been specified without synchronous setting for the counter clear source. tgra_3 (h'ffff) h'0000 tcfv_3 tcfv_4 counter cleared by compare match 3a not set not set tcnt_3 = tcnt_4 figure 18.82 reset sync pwm mode overflow flag 18.7.16 conflict between overflow/ underflow and counter clearing if overflow/underflow and counter clearing occur simultaneously, the tcfv/tcfu flag in tsr is not set and tcnt clearing takes precedence. figure 18.83 shows the operation timing when a tgr compare match is sp ecified as the clearing source, and when h'ff ff is set in tgr.
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 639 of 982 rej09b0023-0400 counter clear signal tcnt tcnt input clock p h'ffff h'0000 tgf tcfv disabled figure 18.83 conflict between overflow and coun ter clearing 18.7.17 conflict between tcnt write and overflow/underflow if there is an up-count or down-count in the t2 state of a tcnt write cycle, and overflow/underflow occurs, the tcnt write takes precedence and the tcfv/tcfu flag in tsr is not set. figure 18.84 shows the operation timing when there is conflict between tcnt write and overflow. write signal address p tcnt address tcnt tcnt write cycle t1 t2 h'ffff m tcnt write data tcfv flag figure 18.84 conflict between tcnt write and overflow
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 640 of 982 rej09b0023-0400 18.7.18 cautions on transition from normal operation or pwm mode 1 to reset-synchronous pwm mode when making a transition from channel 3 or 4 normal operation or pwm mode 1 to reset- synchronous pwm mode, if the counter is halted with the output pins (tioc3b, tioc3d, tioc4a, tioc4c, tioc4b, tioc4d) in the high-imp edance state, followed by the transition to reset-synchronous pwm mode and operation in that mode, the initial pin output will not be correct. when making a transition from normal operation to reset-synchronous pwm mode, write h'11 to registers tiorh_3, tiorl_3, tiorh_4, and tiorl_4 to initialize the output pins to low level output, then set an initial register value of h'00 before making the mode transition. when making a transition from pwm mode 1 to reset-synchronous pwm mode, first switch to normal operation, then initialize the output pins to low level output and set an initial register value of h'00 before making the transition to reset-synchronous pwm mode. 18.7.19 output level in complementary pw m mode and reset-synchronous pwm mode when channels 3 and 4 are in complementary pwm mode or reset-synchronous pwm mode, the pwm waveform output level is set with the olsp and olsn bits in the timer output control register (tocr). in the case of complementary pwm mode or reset-synchronous pwm mode, tior should be set to h'00. 18.7.20 interrupts in module standby mode if module standby mode is entered when an interrup t has been requested, it will not be possible to clear the cpu interrupt source or the dma activ ation source. interrupts should therefore be disabled before entering module standby mode. 18.7.21 simultaneous input capture of tc nt_1 and tcnt_2 in cascade connection when cascade-connected timer counters (tcn t_1 and tcnt_2) are ope rated, cascade values cannot be captured even if input capture is executed simultaneously with tioc1a or tioc2a and tioc1b or tioc2b.
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 641 of 982 rej09b0023-0400 18.8 mtu output pin initialization 18.8.1 operating modes the mtu has the following six operating modes. waveform output is possible in all of these modes. ? normal mode (channels 0 to 4) ? pwm mode 1 (channels 0 to 4) ? pwm mode 2 (channels 0 to 2) ? phase counting modes 1 to 4 (channels 1 and 2) ? complementary pwm mode (channels 3 and 4) ? reset-synchronous pwm mode (channels 3 and 4) the mtu output pin initialization method for each of these modes is described in this section. 18.8.2 reset start operation the mtu output pins (tioc*) are initialized to low by a power-on reset or in standby mode. since mtu pin function selection is performed by the pin function controller (pfc), when the pfc is set, the mtu pin states at that point are output to the ports. when mtu output is selected by the pfc immediately after a pow er-on reset, the mtu output initial level, low, is output directly at the port. when the active level is lo w, the system will oper ate at this point, and therefore the pfc setting should be made after in itialization of the mtu output pins is completed. note: channel number and port notation are substituted for *.
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 642 of 982 rej09b0023-0400 18.8.3 operation in case of re-setting due to error during operation, etc. if an error occurs during mtu operation, mtu output should be cut by the system. cutoff is performed by switching the pin output to port output with the pfc and outputting the inverse of the active level. for large-current pins, output can also be cut by hardware, using port output enable (poe). the pin initialization procedures for re-setting due to an error during operation, etc., and the procedures for restarting in a different mode after re-setting, are shown below. the mtu has six operating modes, as stated above. there are thus 36 mode transition combinations, but some transitions are not available with certain channel and mode combinations. possible mode transition combinations are shown in table 18.43. table 18.43 mode transition combinations after before normal pwm1 pwm2 pcm cpwm rpwm normal (1) (2) (3) (4) (5) (6) pwm1 (7) (8) (9) (10) (11) (12) pwm2 (13) (14) (15) (16) none none pcm (17) (18) (19) (20) none none cpwm (21) (22) none none (23) (24) (25) rpwm (26) (27) none none (28) (29) [legend] normal: normal mode pwm1: pwm mode 1 pwm2: pwm mode 2 pcm: phase counting modes 1 to 4 cpwm: complementary pwm mode rpwm: reset-synchronous pwm mode the above abbreviations are used in some places in following descriptions.
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 643 of 982 rej09b0023-0400 18.8.4 overview of initialization procedures and mode transitions in case of error during operation, etc. ? when making a transition to a mode (normal, pwm1, pwm2, pcm) in which the pin output level is selected by the timer i/o control register (tior) setting, initialize the pins by means of a tior setting. ? in pwm mode 1, since a waveform is not output to the tioc*b (tioc *d) pin, setting tior will not initialize the pins. if initialization is requ ired, carry it out in normal mode, then switch to pwm mode 1. ? in pwm mode 2, since a waveform is not output to the cycle register pin, setting tior will not initialize the pins. if initialization is required, carry it out in normal mode, then switch to pwm mode 2. ? in normal mode or pwm mode 2, if tgrc an d tgrd operate as buffer registers, setting tior will not initialize the buffer register pins. if initialization is required, clear buffer mode, carry out initialization, then set buffer mode again. ? in pwm mode 1, if either tgrc or tgrd operates as a buffer register, setting tior will not initialize the tgrc pin. to initialize the tgrc pin, clear buffer mode, carry out initialization, then set buffer mode again. ? when making a transition to a mode (cpwm, rpwm) in which the pin output level is selected by the timer output control register (tocr) setting, switch to normal mode and perform initialization with tior, then restore tior to its initial value, and temporarily disable channel 3 and 4 output with the timer output master enable register (toer). then operate the unit in accordance with the mode setting procedure (tocr setting, tmdr setting, toer setting). pin initialization procedures are described below for the numbered combinations in table 18.43. the active level is assumed to be low. note: channel number is substituted for * indicated in this article.
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 644 of 982 rej09b0023-0400 (1) operation when error occurs during normal mode operation, and operation is restarted in normal mode figure 18.85 shows an explanatory diagram of the case where an error occurs in normal mode and operation is restarted in normal mode after re-setting. 1 reset 2 tmdr (normal) 3 toer (1) 5 pfc (mtu) 4 tior (1 init 0 out) 6 tstr (1) 7 match 8 error occurs 9 pfc (port) 10 tstr (0) 11 tmdr (normal) 12 tior (1 init 0 out) 13 pfc (mtu) 14 tstr (1) mtu module output tioc*a tioc*b port output tioc*a/pte[n] tioc*b/pte[n] n = 0 to 15 high-z high-z figure 18.85 error occurrence in norm al mode, recovery in normal mode 1. after a reset, mtu output is low and ports are in the hi gh-impedance state. 2. after a reset, the tmdr setting is for normal mode. 3. for channels 3 and 4, enable output with toer before initializing the pins with tior. 4. initialize the pins with tior. (the example shows initial high output, with low output on compare-match occurrence.) 5. set mtu output with the pfc. 6. the count operation is started by tstr. 7. output goes low on compare-match occurrence. 8. an error occurs. 9. set port output with the pfc and output the inverse of the active level. 10. the count operation is stopped by tstr. 11. not necessary when restarting in normal mode. 12. initialize the pins with tior. 13. set mtu output with the pfc. 14. operation is restarted by tstr.
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 645 of 982 rej09b0023-0400 (2) operation when error occurs during normal mode operation, and operation is restarted in pwm mode 1 figure 18.86 shows an explanatory diagram of the case where an error occurs in normal mode and operation is restarted in pwm mode 1 after re-setting. 1 reset 2 tmdr (normal) 3 toer (1) 5 pfc (mtu) 4 tior (1 init 0 out) 6 tstr (1) 7 match 8 error occurs 9 pfc (port) 10 tstr (0) 11 tmdr (pwm1) 12 tior (1 init 0 out) 13 pfc (mtu) 14 tstr (1)  not initialized (tioc*b) high-z high-z mtu module output tioc*a tioc*b port output tioc*a/pte[n] tioc*b/pte[n] n = 0 to 15 figure 18.86 error occurrence in no rmal mode, recovery in pwm mode 1 1 to 10 are the same as in figure 18.85. 11. set pwm mode 1. 12. initialize the pins with tior. (in pwm mode 1, the tioc*b side is not initialized. if initialization is required, initialize in no rmal mode, then switch to pwm mode 1.) 13. set mtu output with the pfc. 14. operation is restarted by tstr.
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 646 of 982 rej09b0023-0400 (3) operation when error occurs during normal mode operation, and operation is restarted in pwm mode 2 figure 18.87 shows an explanatory diagram of the case where an error occurs in normal mode and operation is restarted in pwm mode 2 after re-setting. 1 reset 2 tmdr (normal) 3 toer (1) 5 pfc (mtu) 4 tior (1 init 0 out) 6 tstr (1) 7 match 8 error occurs 9 pfc (port) 10 tstr (0) 11 tmdr (pwm2) 12 tior (1 init 0 out) 13 pfc (mtu) 14 tstr (1)  not initialized (cycle register) high-z high-z mtu module output tioc*a tioc*b port output tioc*a/pte[n] tioc*b/pte[n] n = 0 to 15 figure 18.87 error occurrence in no rmal mode, recovery in pwm mode 2 1 to 10 are the same as in figure 18.85. 11. set pwm mode 2. 12. initialize the pins with tior. (in pwm mode 2, the cycle register pins are not initialized. if initialization is required, initialize in norm al mode, then switch to pwm mode 2.) 13. set mtu output with the pfc. 14. operation is restarted by tstr. note: pwm mode 2 can only be set for channels 0 to 2, and therefore toer setting is not necessary.
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 647 of 982 rej09b0023-0400 (4) operation when error occurs during normal mode operation, and operation is restarted in phase counting mode figure 18.88 shows an explanatory diagram of the case where an error occurs in normal mode and operation is restarted in phase counting mode after re-setting. 1 reset 2 tmdr (normal) 3 toer (1) 5 pfc (mtu) 4 tior (1 init 0 out) 6 tstr (1) 7 match 8 error occurs 9 pfc (port) 10 tstr (0) 11 tmdr (pcm) 12 tior (1 init 0 out) 13 pfc (mtu) 14 tstr (1) high-z high-z mtu module output tioc*a tioc*b port output tioc*a/pte[n] tioc*b/pte[n] n = 0 to 15 figure 18.88 error occurrence in normal mode, recovery in phase counting mode 1 to 10 are the same as in figure 18.85. 11. set phase counting mode. 12. initialize the pins with tior. 13. set mtu output with the pfc. 14. operation is restarted by tstr. note: phase counting mode can only be set for ch annels 1 and 2, and therefore toer setting is not necessary.
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 648 of 982 rej09b0023-0400 (5) operation when error occurs during normal mode operation, and operation is restarted in complementary pwm mode figure 18.89 shows an explanatory diagram of the case where an error occurs in normal mode and operation is restarted in complementary pwm mode after re-setting. 1 reset 2 tmdr (normal) 3 toer (1) 5 pfc (mtu) 4 tior (1 init 0 out) 6 tstr (1) 7 match 8 error occurs 9 pfc (port) 10 tstr (0) 11 tior (0 init 0 out) 12 tior ( disabled ) 13 toer (0) 14 tocr 15 tmdr (cpwm) (16) toer (1) (17) pfc (mtu) (18) tstr (1) mtu module output tioc3a tioc3b tioc3d port output tioc3b/pte[6] tioc3a/pte[7] tioc3d/pte[4] high-z high-z high-z figure 18.89 error occurrence in normal mode, recovery in complementary pwm mode 1 to 10 are the same as in figure 18.85. 11. initialize the normal mode waveform generation section with tior. 12. disable operation of the normal mode waveform generation section with tior. 13. disable channel 3 and 4 output with toer. 14. select the complementary pwm output level and cyclic output enab ling/disabling with tocr. 15. set complementary pwm. 16. enable channel 3 and 4 output with toer. 17. set mtu output with the pfc. 18. operation is restarted by tstr.
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 649 of 982 rej09b0023-0400 (6) operation when error occurs during normal mode operation, and operation is restarted in reset-synchronous pwm mode figure 18.90 shows an explanatory diagram of the case where an error occurs in normal mode and operation is restarted in reset-sync hronous pwm mode after re-setting. 1 reset 2 tmdr (normal) 3 toer (1) 5 pfc (mtu) 4 tior (1 init 0 out) 6 tstr (1) 7 match 8 error occurs 9 pfc (port) 10 tstr (0) 11 tior (0 init 0 out) 12 tior ( disabled ) 13 toer (0) 14 tocr 15 tmdr (cpwm) 16 toer (1) 17 pfc (mtu) 18 tstr (1) high-z high-z high-z mtu module output tioc3a tioc3b tioc3d port output tioc3b/pte[6] tioc3a/pte[7] tioc3d/pte[4] figure 18.90 error occurrence in normal mode, recovery in reset-synchronous pwm mode 1 to 13 are the same as in figure 18.89. 14. select the reset-synchronous pwm output level and cyclic output enabling/disabling with tocr. 15. set reset-synchronous pwm. 16. enable channel 3 and 4 output with toer. 17. set mtu output with the pfc. 18. operation is restarted by tstr.
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 650 of 982 rej09b0023-0400 (7) operation when error occurs during pwm mode 1 operation, and operation is restarted in normal mode figure 18.91 shows an explanatory diagram of the case where an error occurs in pwm mode 1 and operation is restarted in normal mode after re-setting. 1 reset 2 tmdr (pwm1) 3 toer (1) 5 pfc (mtu) 4 tior (1 init 0 out) 6 tstr (1) 7 match 8 error occurs 9 pfc (port) 10 tstr (0) 11 tmdr (normal) 12 tior (1 init 0 out) 13 pfc (mtu) 14 tstr (1)  not initialized (tioc*b) high-z high-z mtu module output tioc*a tioc*b port output tioc*a/pte[n] tioc*b/pte[n] n = 0 to 15 figure 18.91 error occurrence in pwm mode 1, recovery in normal mode 1. after a reset, mtu output is low and ports are in the hi gh-impedance state. 2. set pwm mode 1. 3. for channels 3 and 4, enable output with toer before initializing the pins with tior. 4. initialize the pins with tior. (the example shows initial high output, with low output on compare-match occurrence. in pwm mode 1, the tioc*b side is not initialized.) 5. set mtu output with the pfc. 6. the count operation is started by tstr. 7. output goes low on compare-match occurrence. 8. an error occurs. 9. set port output with the pfc and output the inverse of the active level. 10. the count operation is stopped by tstr. 11. set normal mode. 12. initialize the pins with tior. 13. set mtu output with the pfc. 14. operation is restarted by tstr.
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 651 of 982 rej09b0023-0400 (8) operation when error occurs during pwm mode 1 operation, and operation is restarted in pwm mode 1 figure 18.92 shows an explanatory diagram of the case where an error occurs in pwm mode 1 and operation is restarted in pwm mode 1 after re-setting. 1 reset 2 tmdr (pwm1) 3 toer (1) 5 pfc (mtu) 4 tior (1 init 0 out) 6 tstr (1) 7 match 8 error occurs 9 pfc (port) 10 tstr (0) 11 tmdr (pwm1) 12 tior (1 init 0 out) 13 pfc (mtu) 14 tstr (1)  not initialized (tioc*b)  not initialized (tioc*b) high-z high-z mtu module output tioc*a tioc*b port output tioc*a/pte[n] tioc*b/pte[n] n = 0 to 15 figure 18.92 error occurrence in pw m mode 1, recovery in pwm mode 1 1 to 10 are the same as in figure 18.91. 11. not necessary when restarting in pwm mode 1. 12. initialize the pins with tior. (in pwm mode 1, the tioc*b side is not initialized.) 13. set mtu output with the pfc. 14. operation is restarted by tstr.
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 652 of 982 rej09b0023-0400 (9) operation when error occurs during pwm mode 1 operation, and operation is restarted in pwm mode 2 figure 18.93 shows an explanatory diagram of the case where an error occurs in pwm mode 1 and operation is restarted in pwm mode 2 after re-setting. 1 reset 2 tmdr (pwm1) 3 toer (1) 5 pfc (mtu) 4 tior (1 init 0 out) 6 tstr (1) 7 match 8 error occurs 9 pfc (port) 10 tstr (0) 11 tmdr (pwm2) 12 tior (1 init 0 out) 13 pfc (mtu) 14 tstr (1)  not initialized (tioc*b)  not initialized (cycle register) high-z high-z mtu module output tioc*a tioc*b port output tioc*a/pte[n] tioc*b/pte[n] n = 0 to 15 figure 18.93 error occurrence in pw m mode 1, recovery in pwm mode 2 1 to 10 are the same as in figure 18.91. 11. set pwm mode 2. 12. initialize the pins with tior. (in pwm mode 2, the cycle register pins are not initialized.) 13. set mtu output with the pfc. 14. operation is restarted by tstr. note: pwm mode 2 can only be set for channels 0 to 2, and therefore toer setting is not necessary.
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 653 of 982 rej09b0023-0400 (10) operation when error occurs during pwm mode 1 operation, and operation is restarted in phase counting mode figure 18.94 shows an explanatory diagram of the case where an error occurs in pwm mode 1 and operation is restarted in phase counting mode after re-setting. 1 reset 2 tmdr (pwm1) 3 toer (1) 5 pfc (mtu) 4 tior (1 init 0 out) 6 tstr (1) 7 match 8 error occurs 9 pfc (port) 10 tstr (0) 11 tmdr (pcm) 12 tior (1 init 0 out) 13 pfc (mtu) 14 tstr (1)  not initialized (tioc*b) high-z high-z mtu module output tioc*a tioc*b port output tioc*a/pte[n] tioc*b/pte[n] n = 0 to 15 figure 18.94 error occurrence in pwm mode 1, recovery in phase counting mode 1 to 10 are the same as in figure 18.91. 11. set phase counting mode. 12. initialize the pins with tior. 13. set mtu output with the pfc. 14. operation is restarted by tstr. note: phase counting mode can only be set for ch annels 1 and 2, and therefore toer setting is not necessary.
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 654 of 982 rej09b0023-0400 (11) operation when error occurs during pwm mode 1 operation, and operation is restarted in complementary pwm mode figure 18.95 shows an explanatory diagram of the case where an error occurs in pwm mode 1 and operation is restarted in comple mentary pwm mode after re-setting. 1 reset 2 tmdr (pwm1) 3 toer (1) 5 pfc (mtu) 4 tior (1 init 0 out) 6 tstr (1) 7 match 8 error occurs 9 pfc (port) 10 tstr (0) 11 tmdr (normal) 12 tior (0 init 0 out) 13 tior ( disabled ) 14 toer (0) 15 tocr 16 tmdr (cpwm) 17 toer (1) 18 pfc (mtu) 19 tstr (1)  not initialized (tioc3b)  not initialized (tioc3d) high-z high-z high-z mtu module output tioc3a tioc3b tioc3d port output tioc3b/pte[6] tioc3a/pte[7] tioc3d/pte[4] figure 18.95 error occurrence in pwm mode 1, recovery in complementary pwm mode 1 to 10 are the same as in figure 18.91. 11. set normal mode for initialization of the normal mode waveform generation section. 12. initialize the pwm mode 1 waveform generation section with tior. 13. disable operation of the pwm mode 1 waveform generation section with tior. 14. disable channel 3 and 4 output with toer. 15. select the complementary pwm output level and cyclic output enabling/disabling with tocr. 16. set complementary pwm. 17. enable channel 3 and 4 output with toer. 18. set mtu output with the pfc. 19. operation is restarted by tstr.
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 655 of 982 rej09b0023-0400 (12) operation when error occurs during pwm mode 1 operation, and operation is restarted in reset-synchronous pwm mode figure 18.96 shows an explanatory diagram of the case where an error occurs in pwm mode 1 and operation is restarted in reset-synchronous pwm mode after re-setting. 1 reset 2 tmdr (pwm1) 3 toer (1) 5 pfc (mtu) 4 tior (1 init 0 out) 6 tstr (1) 7 match 8 error occurs 9 pfc (port) 10 tstr (0) 11 tmdr (normal) 12 tior (0 init 0 out) 13 tior ( disabled ) 14 toer (0) 15 tocr 16 tmdr (rpwm) 17 toer (1) 18 pfc (mtu) 19 tstr (1)  not initialized (tioc3b)  not initialized (tioc3d) high-z high-z high-z mtu module output tioc3a tioc3b tioc3d port output tioc3b/pte[6] tioc3a/pte[7] tioc3d/pte[4] figure 18.96 error occurrence in pwm mode 1, recovery in reset-synchronous pwm mode 1 to 14 are the same as in figure 18.95. 15. select the reset-synchronous pwm output level and cyclic output enabling/disabling with tocr. 16. set reset-synchronous pwm. 17. enable channel 3 and 4 output with toer. 18. set mtu output with the pfc. 19. operation is restarted by tstr.
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 656 of 982 rej09b0023-0400 (13) operation when error occurs during pwm mode 2 operation, and operation is restarted in normal mode figure 18.97 shows an explanatory diagram of the case where an error occurs in pwm mode 2 and operation is restarted in normal mode after re-setting. 1 reset 2 tmdr (pwm2) 3 tior (1 init 0 out) 5 tstr (1) 4 pfc (mtu) 6 match 7 error occurs 8 pfc (port) 9 tstr (0) 10 tmdr (normal) 11 tior (1 init 0 out) 12 pfc (mtu) 13 tstr (1)  not initialized (cycle register) high-z high-z mtu module output tioc*a tioc*b port output tioc*a/pte[n] tioc*b/pte[n] n = 0 to 15 figure 18.97 error occurrence in pwm mode 2, recovery in normal mode 1. after a reset, mtu output is low and ports are in the hi gh-impedance state. 2. set pwm mode 2. 3. initialize the pins with tior. (the example shows initial high output, with low output on compare-match occurrence. in pwm mode 2, the cycle register pins are not initialized. in the example, tioc *a is the cycle register.) 4. set mtu output with the pfc. 5. the count operation is started by tstr. 6. output goes low on compare-match occurrence. 7. an error occurs. 8. set port output with the pfc and output the inverse of the active level. 9. the count operation is stopped by tstr. 10. set normal mode. 11. initialize the pins with tior. 12. set mtu output with the pfc. 13. operation is restarted by tstr.
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 657 of 982 rej09b0023-0400 (14) operation when error occurs during pwm mode 2 operation, and operation is restarted in pwm mode 1 figure 18.98 shows an explanatory diagram of the case where an error occurs in pwm mode 2 and operation is restarted in pwm mode 1 after re-setting. 1 reset 2 tmdr (pwm2) 3 tior (1 init 0 out) 5 tstr (1) 4 pfc (mtu) 6 match 7 error occurs 8 pfc (port) 9 tstr (0) 10 tmdr (pwm1) 11 tior (1 init 0 out) 12 pfc (mtu) 13 tstr (1)  not initialized (tioc*b)  not initialized (cycle register) high-z high-z mtu module output tioc*a tioc*b port output tioc*a/pte[n] tioc*b/pte[n] n = 0 to 15 figure 18.98 error occurrence in pw m mode 2, recovery in pwm mode 1 1 to 9 are the same as in figure 18.97. 10. set pwm mode 1. 11. initialize the pins with tior. (in pwm mode 1, the tioc*b side is not initialized.) 12. set mtu output with the pfc. 13. operation is restarted by tstr.
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 658 of 982 rej09b0023-0400 (15) operation when error occurs during pwm mode 2 operation, and operation is restarted in pwm mode 2 figure 18.99 shows an explanatory diagram of the case where an error occurs in pwm mode 2 and operation is restarted in pwm mode 2 after re-setting. 1 reset 2 tmdr (pwm2) 3 tior (1 init 0 out) 5 tstr (1) 4 pfc (mtu) 6 match 7 error occurs 8 pfc (port) 9 tstr (0) 10 tmdr (pwm2) 11 tior (1 init 0 out) 12 pfc (mtu) 13 tstr (1)  not initialized (cycle register)  not initialized (cycle register) high-z high-z mtu module output tioc*a tioc*b port output tioc*a/pte[n] tioc*b/pte[n] n = 0 to 15 figure 18.99 error occurrence in pw m mode 2, recovery in pwm mode 2 1 to 9 are the same as in figure 18.97. 10. not necessary when restarting in pwm mode 2. 11. initialize the pins with tior. (in pwm mode 2, the cycle register pins are not initialized.) 12. set mtu output with the pfc. 13. operation is restarted by tstr.
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 659 of 982 rej09b0023-0400 (16) operation when error occurs during pwm mode 2 operation, and operation is restarted in phase counting mode figure 18.100 shows an explanatory diagram of the case where an error occurs in pwm mode 2 and operation is restarted in phase counting mode after re-setting. 1 reset 2 tmdr (pwm2) 3 tior (1 init 0 out) 5 tstr (1) 4 pfc (mtu) 6 match 7 error occurs 8 pfc (port) 9 tstr (0) 10 tmdr (pcm) 11 tior (1 init 0 out) 12 pfc (mtu) 13 tstr (1)  not initialized (cycle register) high-z high-z mtu module output tioc*a tioc*b port output tioc*a/pte[n] tioc*b/pte[n] n = 0 to 15 figure 18.100 error occurrence in pwm mo de 2, recovery in phase counting mode 1 to 9 are the same as in figure 18.97. 10. set phase counting mode. 11. initialize the pins with tior. 12. set mtu output with the pfc. 13. operation is restarted by tstr.
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 660 of 982 rej09b0023-0400 (17) operation when error oc curs during phase counting mode operation, and operation is restarted in normal mode figure 18.101 shows an explanatory diagram of the case where an error oc curs in phase counting mode and operation is restarted in normal mode after re-setting. 1 reset 2 tmdr (pcm) 3 tior (1 init 0 out) 5 tstr (1) 4 pfc (mtu) 6 match 7 error occurs 8 pfc (port) 9 tstr (0) 10 tmdr (normal) 11 tior (1 init 0 out) 12 pfc (mtu) 13 tstr (1) high-z high-z mtu module output tioc*a tioc*b port output tioc*a/pte[n] tioc*b/pte[n] n = 0 to 15 figure 18.101 error occurrence in phase counting mode, recovery in normal mode 1. after a reset, mtu output is low and ports are in the hi gh-impedance state. 2. set phase counting mode. 3. initialize the pins with tior. (the example shows initial high output, with low output on compare-match occurrence.) 4. set mtu output with the pfc. 5. the count operation is started by tstr. 6. output goes low on compare-match occurrence. 7. an error occurs. 8. set port output with the pfc and output the inverse of the active level. 9. the count operation is stopped by tstr. 10. set in normal mode. 11. initialize the pins with tior. 12. set mtu output with the pfc. 13. operation is restarted by tstr.
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 661 of 982 rej09b0023-0400 (18) operation when error oc curs during phase counting mode operation, and operation is restarted in pwm mode 1 figure 18.102 shows an explanatory diagram of th e case where an error occu rs in phase counting mode and operation is restarted in pwm mode 1 after re-setting. 1 reset 2 tmdr (pcm) 3 tior (1 init 0 out) 5 tstr (1) 4 pfc (mtu) 6 match 7 error occurs 8 pfc (port) 9 tstr (0) 10 tmdr (pwm1) 11 tior (1 init 0 out) 12 pfc (mtu) 13 tstr (1)  not initialized (tioc*b) high-z high-z mtu module output tioc*a tioc*b port output tioc*a/pte[n] tioc*b/pte[n] n = 0 to 15 figure 18.102 error occurrence in phase counting mode, recovery in pwm mode 1 1 to 9 are the same as in figure 18.101. 10. set pwm mode 1. 11. initialize the pins with tior. (in pwm mode 1, the tioc *b side is not initialized.) 12. set mtu output with the pfc. 13. operation is restarted by tstr.
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 662 of 982 rej09b0023-0400 (19) operation when error oc curs during phase counting mode operation, and operation is restarted in pwm mode 2 figure 18.103 shows an explanatory diagram of the case where an error oc curs in phase counting mode and operation is restarted in pwm mode 2 after re-setting. 1 reset 2 tmdr (pcm) 3 tior (1 init 0 out) 5 tstr (1) 4 pfc (mtu) 6 match 7 error occurs 8 pfc (port) 9 tstr (0) 10 tmdr (pwm2) 11 tior (1 init 0 out) 12 pfc (mtu) 13 tstr (1) high-z high-z  not initialized (cycle register) mtu module output tioc*a tioc*b port output tioc*a/pte[n] tioc*b/pte[n] n = 0 to 15 figure 18.103 error occurrence in phase counting mode, recovery in pwm mode 2 1 to 9 are the same as in figure 18.101. 10. set pwm mode 2. 11. initialize the pins with tior. (in pwm mode 2, the cycle register pins are not initialized.) 12. set mtu output with the pfc. 13. operation is restarted by tstr.
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 663 of 982 rej09b0023-0400 (20) operation when error oc curs during phase counting mode operation, and operation is restarted in phase counting mode figure 18.104 shows an explanatory diagram of th e case where an error occu rs in phase counting mode and operation is restarted in phase counting mode after re-setting. 1 reset 2 tmdr (pcm) 3 tior (1 init 0 out) 5 tstr (1) 4 pfc (mtu) 6 match 7 error occurs 8 pfc (port) 9 tstr (0) 10 tmdr (pcm) 11 tior (1 init 0 out) 12 pfc (mtu) 13 tstr (1) high-z high-z mtu module output tioc*a tioc*b port output tioc*a/pte[n] tioc*b/pte[n] n = 0 to 15 figure 18.104 error occurren ce in phase counting mode, recovery in phase counting mode 1 to 9 are the same as in figure 18.101. 10. not necessary when restarting in phase counting mode. 11. initialize the pins with tior. 12. set mtu output with the pfc. 13. operation is restarted by tstr.
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 664 of 982 rej09b0023-0400 (21) operation when error occurs during complementary pwm mode operation, and operation is restarted in normal mode figure 18.105 shows an explanatory diagram of the case where an error occurs in complementary pwm mode and operation is restarted in normal mode after re-setting. 1 reset 2 tocr 3 tmdr (cpwm) 5 pfc (mtu) 4 toer (1) 6 tstr (1) 7 match 8 error occurs 9 pfc (port) 10 tstr (0) 11 tmdr (normal) 12 tior (1 init 0 out) 13 pfc (mtu) 14 tstr (1) high-z high-z high-z mtu module output tioc3a tioc3b tioc3d port output tioc3b/pte[6] tioc3a/pte[7] tioc3d/pte[4] figure 18.105 error occurren ce in complementary pwm mode, recovery in normal mode 1. after a reset, mtu output is low and ports are in the hi gh-impedance state. 2. select the complementary pwm output level and cyclic output enabling/disabling with tocr. 3. set complementary pwm. 4. enable channel 3 and 4 output with toer. 5. set mtu output with the pfc. 6. the count operation is started by tstr. 7. the complementary pwm waveform is output on compare-match occurrence. 8. an error occurs. 9. set port output with the pfc and output the inverse of the active level. 10. the count operation is stopped by tstr. (mtu output becomes the complementary pwm output initial value.) 11. set normal mode. (mtu output goes low.) 12. initialize the pins with tior. 13. set mtu output with the pfc. 14. operation is restarted by tstr.
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 665 of 982 rej09b0023-0400 (22) operation when error occurs during complementary pwm mode operation, and operation is restarted in pwm mode 1 figure 18.106 shows an explanatory diagram of the case where an error occurs in complementary pwm mode and operation is restarted in pwm mode 1 after re-setting. 1 reset 2 tocr 3 tmdr (cpwm) 5 pfc (mtu) 4 toer (1) 6 tstr (1) 7 match 8 error occurs 9 pfc (port) 10 tstr (0) 11 tmdr (pwm1) 12 tior (1 init 0 out) 13 pfc (mtu) 14 tstr (1)  not initialized (tioc3b)  not initialized (tioc3d) high-z high-z high-z mtu module output tioc3a tioc3b tioc3d port output tioc3b/pte[6] tioc3a/pte[7] tioc3d/pte[4] figure 18.106 error occurren ce in complementary pwm mode, recovery in pwm mode 1 1 to 10 are the same as in figure 18.105. 11. set pwm mode 1. (mtu output goes low.) 12. initialize the pins with tior. (in pwm mode 1, the tioc *b side is not initialized.) 13. set mtu output with the pfc. 14. operation is restarted by tstr.
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 666 of 982 rej09b0023-0400 (23) operation when error occurs during complementary pwm mode operation, and operation is restarted in complementary pwm mode figure 18.107 shows an explanatory diagram of the case where an error occurs in complementary pwm mode and operation is restarted in complementary pwm mode after re-setting (when operation is restarted using the cycle and duty settings at the time the counter was stopped). 1 reset 2 tocr 3 tmdr (cpwm) 5 pfc (mtu) 4 toer (1) 6 tstr (1) 7 match 8 error occurs 9 pfc (port) 10 tstr (0) 11 pfc (mtu) 12 tstr (1) 13 match high-z high-z high-z mtu module output tioc3a tioc3b tioc3d port output tioc3b/pte[6] tioc3a/pte[7] tioc3d/pte[4] figure 18.107 error o ccurrence in complementary pwm mode, recovery in complementary pwm mode 1 to 10 are the same as in figure 18.105. 11. set mtu output with the pfc. 12. operation is restarted by tstr. 13. the complementary pwm waveform is output on compare-match occurrence.
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 667 of 982 rej09b0023-0400 (24) operation when error occurs during complementary pwm mode operation, and operation is restarted in complementary pwm mode figure 18.108 shows an explanatory diagram of the case where an error occurs in complementary pwm mode and operation is restarted in co mplementary pwm mode after re-setting (when operation is restarted using completely new cycle and duty settings). 1 reset 2 tocr 3 tmdr (cpwm) 5 pfc (mtu) 4 toer (1) 6 tstr (1) 7 match 8 error occurs 9 pfc (port) 10 tstr (0) 11 tmdr (normal) 12 toer (0) 13 tocr 14 tmdr (cpwm) 15 toer (1) 16 pfc (mtu) 17 tstr (1) high-z high-z high-z mtu module output tioc3a tioc3b tioc3d port output tioc3b/pte[6] tioc3a/pte[7] tioc3d/pte[4] figure 18.108 error occurren ce in complementary pwm mode, recovery in complementary pwm mode 1 to 10 are the same as in figure 18.105. 11. set normal mode and make new settings. (mtu output goes low.) 12. disable channel 3 and 4 output with toer. 13. select the complementary pwm mode output level and cyclic output enabling/disabling with tocr. 14. set complementary pwm. 15. enable channel 3 and 4 output with toer. 16. set mtu output with the pfc. 17. operation is restarted by tstr.
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 668 of 982 rej09b0023-0400 (25) operation when error occurs during complementary pwm mode operation, and operation is restarted in reset-synchronous pwm mode figure 18.109 shows an explanatory diagram of the case where an error occurs in complementary pwm mode and operation is restarted in reset-synchronous pwm mode. 1 reset 2 tocr 3 tmdr (cpwm) 5 pfc (mtu) 4 toer (1) 6 tstr (1) 7 match 8 error occurs 9 pfc (port) 10 tstr (0) 11 tmdr (normal) 12 toer (0) 13 tocr 14 tmdr (rpwm) 15 toer (1) 16 pfc (mtu) 17 tstr (1) high-z high-z high-z mtu module output tioc3a tioc3b tioc3d port output tioc3b/pte[6] tioc3a/pte[7] tioc3d/pte[4] figure 18.109 error occurren ce in complementary pwm mode, recovery in reset-synchronous pwm mode 1 to 10 are the same as in figure 18.105. 11. set normal mode. (mtu output goes low.) 12. disable channel 3 and 4 output with toer. 13. select the reset-synchronous pwm mode output level and cyclic output enabling/disabling with tocr. 14. set reset-synchronous pwm. 15. enable channel 3 and 4 output with toer. 16. set mtu output with the pfc. 17. operation is restarted by tstr.
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 669 of 982 rej09b0023-0400 (26) operation when error oc curs during reset-synchronous pwm mode operation, and operation is restarted in normal mode figure 18.110 shows an explanatory diagram of the case where an error occurs in reset- synchronous pwm mode and operation is restarted in normal mode after re-setting. 1 reset 2 tocr 3 tmdr (cpwm) 5 pfc (mtu) 4 toer (1) 6 tstr (1) 7 match 8 error occurs 9 pfc (port) 10 tstr (0) 11 tmdr (normal) 12 tior (1 init 0 out) 13 pfc (mtu) 14 tstr (1) high-z high-z high-z mtu module output tioc3a tioc3b tioc3d port output tioc3b/pte[6] tioc3a/pte[7] tioc3d/pte[4] figure 18.110 error occurrence in reset-synchronous pwm mode, recovery in normal mode 1. after a reset, mtu output is low and ports are in the hi gh-impedance state. 2. select the reset-synchronous pwm output level and cyclic output enabling/disabling with tocr. 3. set reset-synchronous pwm. 4. enable channel 3 and 4 output with toer. 5. set mtu output with the pfc. 6. the count operation is started by tstr. 7. the reset-synchronous pwm waveform is output on compare-match occurrence. 8. an error occurs. 9. set port output with the pfc and output the inverse of the active level. 10. the count operation is stopped by tstr. (mtu output becomes the reset-synchronous pwm output initial value.) 11. set normal mode. (mtu positive phase output is low, and negative phase output is high.) 12. initialize the pins with tior. 13. set mtu output with the pfc. 14. operation is restarted by tstr.
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 670 of 982 rej09b0023-0400 (27) operation when error oc curs during reset-synchronous pwm mode operation, and operation is restarted in pwm mode 1 figure 18.111 shows an explanatory diagram of the case where an error occurs in reset- synchronous pwm mode and operation is re started in pwm mode 1 after re-setting. 1 reset 2 tocr 3 tmdr (rpwm) 5 pfc (mtu) 4 toer (1) 6 tstr (1) 7 match 8 error occurs 9 pfc (port) 10 tstr (0) 11 tmdr (pwm1) 12 tior (1 init 0 out) 13 pfc (mtu) 14 tstr (1)  not initialized (tioc3b)  not initialized (tioc3d) high-z high-z high-z mtu module output tioc3a tioc3b tioc3d port output tioc3b/pte[6] tioc3a/pte[7] tioc3d/pte[4] figure 18.111 error occurrence in reset-synchronous pwm mode, recovery in pwm mode 1 1 to 10 are the same as in figure 18.110. 11. set pwm mode 1. (mtu positive phase output is low, and negative phase output is high.) 12. initialize the pins with tior. (in pwm mode 1, the tioc *b side is not initialized.) 13. set mtu output with the pfc. 14. operation is restarted by tstr.
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 671 of 982 rej09b0023-0400 (28) operation when error oc curs during reset-synchronous pwm mode operation, and operation is restarted in complementary pwm mode figure 18.112 shows an explanatory diagram of the case where an error occurs in reset- synchronous pwm mode and operation is restarted in complementary pwm mode after re-setting. 1 reset 2 tocr 3 tmdr (rpwm) 5 pfc (mtu) 4 toer (1) 6 tstr (1) 7 match 8 error occurs 9 pfc (port) 10 tstr (0) 11 toer (0) 12 tocr 13 tmdr (cpwm) 14 toer (1) 15 pfc (mtu) 16 tstr (1) high-z high-z high-z mtu module output tioc3a tioc3b tioc3d port output tioc3b/pte[6] tioc3a/pte[7] tioc3d/pte[4] figure 18.112 error occurrence in reset-synchronous pwm mode, recovery in complementary pwm mode 1 to 10 are the same as in figure 18.110. 11. disable channel 3 and 4 output with toer. 12. select the complementary pwm output level and cyclic output enabling/disabling with tocr. 13. set complementary pwm. (the mtu cyclic output pin goes low.) 14. enable channel 3 and 4 output with toer. 15. set mtu output with the pfc. 16. operation is restarted by tstr.
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 672 of 982 rej09b0023-0400 (29) operation when error oc curs during reset-synchronous pwm mode operation, and operation is restarted in reset-synchronous pwm mode figure 18.113 shows an explanatory diagram of the case where an error occurs in reset- synchronous pwm mode and operation is restarted in reset-synchronous pwm mode after re- setting. 1 reset 2 tocr 3 tmdr (rpwm) 5 pfc (mtu) 4 toer (1) 6 tstr (1) 7 match 8 error occurs 9 pfc (port) 10 tstr (0) 11 pfc (mtu) 12 tstr (1) 13 match high-z high-z high-z high-z high-z high-z mtu module output tioc3a tioc3b tioc3d port output tioc3b/pte[6] tioc3a/pte[7] tioc3d/pte[4] figure 18.113 error occurrence in reset-synchronous pwm mode, recovery in reset-synchronous pwm mode 1 to 10 are the same as in figure 18.110. 11. set mtu output with the pfc. 12. operation is restarted by tstr. 13. the reset-synchronous pwm waveform is output on compare-match occurrence.
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 673 of 982 rej09b0023-0400 18.9 port output enable (poe) the port output enable (poe) can be used to es tablish a high-impedance state for high-current pins, by changing the poe0 to poe3 pin input, depending on the output status of the high-current pins (tioc3b/pte[6], tioc3d/pte[4], tioc4a/pte[3], tioc4b/pte[2], tioc4c/pte[1], tioc4d/pte[0]). it can also simultaneously generate interrupt requests. 18.9.1 features ? each of the poe0 to poe3 input pins can be set for falling edge, p /8 16, p /16 16, or p /128 16 low-level sampling. ? high-current pins can be set to high-impedance state by poe0 to poe3 pin falling-edge or low-level sampling. ? high-current pins can be set to high-impedance state when the high-current pin output levels are compared and simultaneous low-level output continues for one cycle or more. ? interrupts can be generated by input-level sampling or output-level comparison results.
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 674 of 982 rej09b0023-0400 the poe has input-level detection circuitry and outp ut-level detection circuitry, as shown in the block diagram of figure 18.114. tioc3b tioc3d tioc4a tioc4c tioc4b tioc4d poe3 poe2 poe1 poe0 output level detection circuit output level detection circuit output level detection circuit input level detection circuit falling-edge detection circuit low-level detection circuit ocsr devider icsr1 /8 /16 p /128 hi-z request control signal interrupt request [legend] ocsr: output level control/status register icsr1: input level control/status register figure 18.114 poe block diagram
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 675 of 982 rej09b0023-0400 18.9.2 pin configuration table 18.44 pin configuration name abbreviation i/o description port output enable input pins poe0 to poe3 input input request signals to make high- current pins high-impedance state table 18.45 shows output-level comparisons with pin combinations. table 18.45 pin combinations pin combination i/o description tioc3b/pte[6] and tioc3d/pte[4] output all high-current pins are made high-impedance state when the pins simultaneously output low-level for longer than 1 cycle. tioc4a/pte[3] and tioc4c/pte[1] output all high-current pins are made high-impedance state when the pins simultaneously output low-level for longer than 1 cycle. tioc4b/pte[2] and tioc4d/pte[0] output all high-current pins are made high-impedance state when the pins simultaneously output low-level for longer than 1 cycle. 18.9.3 register configuration the poe has the two registers. the input level control/status register 1 (icsr1) controls both poe0 to poe3 pin input signal detection and interrupts. the output level control/status register (ocsr) controls both the enable/disable of output comparison and interrupts. input level control/status register 1 (icsr1): icsr1 is a 16-bit readable/writable register that selects the poe0 to poe3 pin input modes, controls the en able/disable of interrupts, and indicates status.
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 676 of 982 rej09b0023-0400 bit bit name initial value r/w description 15 poe3f 0 r/(w) * poe3 flag this flag indicates that a high impedance request has been input to the poe3 pin [clear condition] ? by writing 0 to poe3f after reading a poe3f = 1 [set condition] ? when the input set by icsr1 bits 7 and 6 occurs at the poe3 pin 14 poe2f 0 r/(w) * poe2 flag this flag indicates that a high impedance request has been input to the poe2 pin [clear condition] ? by writing 0 to poe2f after reading a poe2f = 1 [set condition] ? when the input set by icsr1 bits 5 and 4 occurs at the poe2 pin 13 poe1f 0 r/(w) * poe1 flag this flag indicates that a high impedance request has been input to the poe1 pin [clear condition] ? by writing 0 to poe1f after reading a poe1f = 1 [set condition] ? when the input set by icsr1 bits 3 and 2 occurs at the poe1 pin 12 poe0f 0 r/(w) * poe0 flag this flag indicates that a high impedance request has been input to the poe0 pin [clear condition] ? by writing 0 to poe0f after reading a poe0f = 1 [set condition] ? when the input set by icsr1 bits 1 and 0 occurs at the poe0 pin
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 677 of 982 rej09b0023-0400 bit bit name initial value r/w description 11 to 9 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 8 pie 0 r/w port interrupt enable this bit enables/disables interrupt requests when any of the poe0f to poe3f bits of the icsr1 are set to 1 0: interrupt requests disabled 1: interrupt requests enabled 7 6 poe3m1 poe3m0 0 0 r/w r/w poe3 mode 1, 0 these bits select the input mode of the poe3 pin. 00: accept request on falling edge of poe3 input 01: accept request when poe3 input has been sampled for 16 p /8 clock pulses, and all are low level. 10: accept request when poe3 input has been sampled for 16 p /16 clock pulses, and all are low level. 11: accept request when poe3 input has been sampled for 16 p /128 clock pulses, and all are low level. 5 4 poe2m1 poe2m0 0 0 r/w r/w poe2 mode 1, 0 these bits select the input mode of the poe2 pin. 00: accept request on falling edge of poe2 input 01: accept request when poe2 input has been sampled for 16 p /8 clock pulses, and all are low level. 10: accept request when poe2 input has been sampled for 16 p /16 clock pulses, and all are low level. 11: accept request when poe2 input has been sampled for 16 p /128 clock pulses, and all are low level.
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 678 of 982 rej09b0023-0400 bit bit name initial value r/w description 3 2 poe1m1 poe1m0 0 0 r/w r/w poe1 mode 1, 0 these bits select the input mode of the poe1 pin. 00: accept request on falling edge of poe1 input 01: accept request when poe1 input has been sampled for 16 p /8 clock pulses, and all are low level. 10: accept request when poe1 input has been sampled for 16 p /16 clock pulses, and all are low level. 11: accept request when poe1 input has been sampled for 16 p /128 clock pulses, and all are low level. 1 0 poe0m1 poe0m0 0 0 r/w r/w poe0 mode 1, 0 these bits select the input mode of the poe0 pin. 00: accept request on falling edge of poe0 input 01: accept request when poe0 input has been sampled for 16 p /8 clock pulses, and all are low level. 10: accept request when poe0 input has been sampled for 16 p /16 clock pulses, and all are low level. 11: accept request when poe0 input has been sampled for 16 p /128 clock pulses, and all are low level. note: * the write value should always be 0.
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 679 of 982 rej09b0023-0400 output level control/status register (ocsr): ocsr is a 16-bit readable /writable register that controls the enable/disable of both output level co mparison and inte rrupts, and indicates status. if the osf bit is set to 1, the high current pins become high impedance. bit bit name initial value r/w description 15 osf 0 r/(w) * output short flag this flag indicates that any one pair of the three pairs of 2 phase outputs compared have simultaneously become low level outputs. [clear condition] ? by writing 0 to osf after reading an osf = 1 [set condition] ? when any one pair of the three 2-phase outputs simultaneously become low level 14 to 10 ? all 0 r reserved these bits are always read as 0. the write value should always be 0.
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 680 of 982 rej09b0023-0400 bit bit name initial value r/w description 9 oce 0 r/w output level compare enable this bit enables the start of output level comparisons. when setting this bit to 1, pay attention to the output pin combinations shown in table 18.43, mode transition combinations. when 0 is output on both pins, the osf bit is set to 1 at the same time when this bit is set, and output goes to high impedance. accordingly, bit 6 and bits 4 to 0 in the port e data register (pedr) are set to 1. for the mtu output comparison, set the bit to 1 after setting the mtu's output pins with the pfc. set this bit only when using pins as outputs. when the oce bit is set to 1, if oie = 0 a high- impedance request will not be issued even if osf is set to 1. therefore, in order to have a high-impedance request issued according to the result of the output level comparison, the oie bit must be set to 1. when oce = 1 and oie = 1, an interrupt request will be generated at the same time as the high-impedance request: however, this interrupt can be masked by means of an interrupt controller (intc) setting. 0: output level compare disabled 1: output level compar e enabled; makes an output high impedance request when osf = 1. 8 oie 0 r/w output short interrupt enable this bit makes interrupt requests when the osf bit of the ocsr is set. 0: interrupt requests disabled 1: interrupt request enabled 7 to 0 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. note: * the write value should always be 0.
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 681 of 982 rej09b0023-0400 18.9.4 operation input level detection operation: if the input conditions set by the icsr1 occur on any of the poe0 to poe3 pins, all high-current pins become high-impedance state. however, only when the general input/output function or mtu function is selected, the large-curren t pin is in the high- impedance state. 1. falling edge detection: when a change from high to low level is input to the poe0 to poe3 pins, all high-current pins become high-impedance state. figure 18.115 shows the timing example for the poe0 to poe3 pins which enters the high-impedance state through input of a change from high to low level. poe input (0 to 3) p rising p tioc3b/ pte[6] note: other high-current pins (tioc3d/pte[4], tioc4a/pte[3], tioc4b/pte[2], tioc4c/pte[1], tioc4d/pte[0]) also become the hi-z state at the same timing. falling edge detected hi-z state figure 18.115 falling edge detection operation
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 682 of 982 rej09b0023-0400 2. low-level detection figure 18.116 shows the low-level detection operation. sixteen continuous low levels are sampled with the sampling clock established by the icsr1. if even one high level is detected during this interval, the low level is not accepted. furthermore, the timing when the large-current pins enter th e high-impedance state from the sampling clock is the same in both falling-edge detection and in low-level detection. p sampling clock 3 poe input tioc3b/ pte[6] when low level is sampled at all points when high level is sampled at least once flag set (poe received) flag not set hi-z state* note: * other high-current pins (tioc3d/pte[4], tioc4a/pte[3], tioc4b/pte[2], tioc4c/pte[1], and tioc4d/pte[0]) also become the hi-z state at the same timing. 2 1 2 1 16 13 8/16/128 clock cycles figure 18.116 low-le vel detection operation output-level compare operation: figure 18.117 shows an exam ple of the output-level compare operation for the combin ation of tioc3b/pte[6] and tioc3d/pte[4]. the operation is the same for the other pin combinations. p tioc3d/ pte[4] tioc3b/ pte[6] 0 level overlapping detected hi-z figure 18.117 output-l evel detection operation
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 683 of 982 rej09b0023-0400 release from high-impedance state: high-current pins that have entered high-impedance state due to input-level detection can be released either by returning them to their initial state with a power-on reset, or by clearing all of the bit 12 to 15 (poe0f to poe3f) flags of the icsr1. high- current pins that have become high-impedance due to output-level detection can be released either by returning them to their initial state with a power-on reset, or by first clearing bit 9 (oce) of the ocsr to disable output-level co mpares, then clearing the bit 15 (osf) flag. however, when returning from high-impedance state by clearing the osf flag, always do so only after outputting a high level from the high-current pins (tioc3b, tioc3d, tioc4a, tioc4b, tioc4c, and tioc4d). high-level outputs can be achieved by setting the mtu internal registers.
section 18 multi-function timer pulse unit (mtu) rev. 4.00 sep. 14, 2005 page 684 of 982 rej09b0023-0400
section 19 serial communication interface with fifo (scif) rev. 4.00 sep. 14, 2005 page 685 of 982 rej09b0023-0400 section 19 serial communi cation interface with fifo (scif) 19.1 overview this lsi has a three-channel serial communication interface with fifo (scif) that supports both asynchronous and clock synchronous serial communi cation. it also has 16-stage fifo registers for both transmission and reception independently for each channel that enable this lsi to perform efficient high-speed co ntinuous communication. 19.1.1 features ? asynchronous serial communication: ? serial data communication is performed by st art-stop in character units. the scif can communicate with a un iversal asynchronous receiver/transmitter (uart), an asynchronous communication interface adapter (acia), or any other communications chip that employs a standard asynchronous serial system. there are eight selectable serial data communication formats. ? data length: 7 or 8 bits ? stop bit length: 1 or 2 bits ? parity: even, odd, or none ? receive error detection: parity , framing, and overrun errors ? break detection: break is detected when a framing error is followed by at least one frame at the space 0 level (low level). it is also detect ed by reading the rxd level directly from the port data register when a framing error occurs. ? synchronous mode: ? serial data communication is synchronized w ith a clock signal. the scif can communicate with other chips having a synchronous communication function. there is one serial data communication format. ? data length: 8 bits ? receive error detecti on: overrun errors ? full duplex communication: the transmitting and receiving sections are independent, so the scif can transmit and receive simultaneously. both sections use 16-stage fifo buffering, so high-speed continuous data transfer is possible in both the transmit and receive directions. ? on-chip baud rate generator with selectable bit rates
section 19 serial communication interface with fifo (scif) rev. 4.00 sep. 14, 2005 page 686 of 982 rej09b0023-0400 ? internal or external tran smit/receive clock source: from either baud rate generator (internal) or sck pin (external) ? four types of interrupts: tr ansmit-fifo-data-empty, break , receive-fifo-data-full, and receive-error interrupts are re quested independently. the dir ect memory access controller (dmac) can be activated to execute a data tran sfer by a transmit-fifo-data-empty or receive- fifo-data-full interrupt. ? when the scif is not in use, it can be stopped by halting the clock supplied to it, saving power. ? in asynchronous, on-chip modem control functions ( rts and cts ). ? the quantity of data in the transmit and receive fifo re gisters and the number of receive errors of the receive data in the recei ve fifo register can be ascertained. ? a time-out error (dr) can be detected when receiving in asynchronous mode. figure 19.1 shows a block diagram of the scif for each channel.
section 19 serial communication interface with fifo (scif) rev. 4.00 sep. 14, 2005 page 687 of 982 rej09b0023-0400 module data bus scfrdr (16 stage) scrsr rxd txd sck cts rts scftdr (16 stage) sctsr scsmr sclsr scfdr scfcr scfsr scbrrn parity generation parity check transmission/ reception control baud rate generator clock external clock p p/4 p/16 p/64 txi rxi eri bri scif bus interface internal data bus scscr scsptr scrsr: scfrdr: sctsr: scftdr: scsmr: scscr: [legend] scfsr: scbrr: scsptr: scfcr: scfdr: sclsr: receive shift register receive fifo data register transmit shift register transmit fifo data register serial mode register serial control register serial status register bit rate register serial port register fifo control register fifo data count register line status register figure 19.1 block diagram of scif
section 19 serial communication interface with fifo (scif) rev. 4.00 sep. 14, 2005 page 688 of 982 rej09b0023-0400 19.2 pin configuration the scif has the serial pins summarized in table 19.1. table 19.1 scif pins channel pin name a bbreviation i/o function serial clock pin sck0 i/o clock i/o receive data pin rxd0 input receive data input transmit data pin txd0 ou tput transmit data output request to send pin rts0 i/o request to send 0 clear to send pin cts0 i/o clear to send serial clock pin sck1 i/o clock i/o receive data pin rxd1 input receive data input transmit data pin txd1 ou tput transmit data output request to send pin rts1 i/o request to send 1 clear to send pin cts1 i/o clear to send serial clock pin sck2 i/o clock i/o receive data pin rxd2 input receive data input transmit data pin txd2 ou tput transmit data output request to send pin rts 2 i/o request to send 2 clear to send pin cts 2 i/o clear to send
section 19 serial communication interface with fifo (scif) rev. 4.00 sep. 14, 2005 page 689 of 982 rej09b0023-0400 19.3 register description the scif has the following regist ers. these registers specify th e data format and bit rate, and control the transmitter and receiver sections. ? receive fifo data re gister_0 (scfrdr_0) ? transmit fifo data register_0 (scftdr_0) ? serial mode register_0 (scsmr_0) ? serial control register_0 (scscr_0) ? serial status regi ster_0 (scfsr_0) ? bit rate register_0 (scbrr_0) ? fifo control register_0 (scfcr_0) ? fifo data count register_0 (scfdr_0) ? serial port register_0 (scsptr_0) ? line status register_0 (sclsr_0) ? receive fifo data re gister_1 (scfrdr_1) ? transmit fifo data register_1 (scftdr_1) ? serial mode register_1 (scsmr_1) ? serial control register_1 (scscr_1) ? serial status regi ster_1 (scfsr_1) ? bit rate register_1 (scbrr_1) ? fifo control register_1 (scfcr_1) ? fifo data count register_1 (scfdr_1) ? serial port register_1 (scsptr_1) ? line status register_1 (sclsr_1) ? receive fifo data re gister_2 (scfrdr_2) ? transmit fifo data register_2 (scftdr_2) ? serial mode register_2 (scsmr_2) ? serial control register_2 (scscr_2) ? serial status regi ster_2 (scfsr_2) ? bit rate register_2 (scbrr_2) ? fifo control register_2 (scfcr_2) ? fifo data count register_2 (scfdr_2) ? serial port register_2 (scsptr_2) ? line status register_2 (sclsr_2)
section 19 serial communication interface with fifo (scif) rev. 4.00 sep. 14, 2005 page 690 of 982 rej09b0023-0400 19.3.1 receive shift register (scrsr) the receive shift register (scrsr) receives serial data. data input at the rxd pin is loaded into scrsr in the order received, lsb (bit 0) first, converting the data to parallel form. when one byte has been received, it is automatically transfe rred to scfrdr, the receive fifo data register. the cpu cannot read or write to scrsr directly. 19.3.2 receive fifo da ta register (scfrdr) the 16-byte receive fifo data re gister (scfrdr) stores serial receive data. the scif completes the reception of one byte of serial data by moving the received data from th e receive shift register (scrsr) into scfrdr for storage. continuous reception is possible until 16 bytes are stored. the cpu can read but not write to scfrdr. if data is read when there is no receive data in the scfrdr, the value is undefined. when this register is full of recei ve data, subsequent serial data is lost. scfrdr is initialized to undefined value by a power-on reset. bit bit name initial value r/w description 7 to 0 ? undefined r fifo for transmits serial data 19.3.3 transmit shift register (sctsr) the transmit shift register (sctsr) transmits seri al data. the scif loads transmit data from the transmit fifo data register (scftdr) into sctsr, then transmits the data serially from the txd pin, lsb (bit 0) first. after transmitting one da ta byte, the scif automatically loads the next transmit data from scftdr into sctsr and starts transmitting again. the cpu cannot read or write to sctsr directly.
section 19 serial communication interface with fifo (scif) rev. 4.00 sep. 14, 2005 page 691 of 982 rej09b0023-0400 19.3.4 transmit fifo data register (scftdr) the transmit fifo data register (scftdr) is a 16 -byte fifo register that stores data for serial transmission. when the scif detects that the tran smit shift register (sctsr) is empty, it moves transmit data written in the scftdr into sctsr and starts serial transmissi on. continuous serial transmission is performed until there is no transmit data left in scftdr. when scftdr is full of transmit data (16 bytes), no more data can be written. if writing of new data is attempted, the data is ignored. scftdr is initialized to undefined value by a power-on reset. bit bit name initial value r/w description 7 to 0 ? undefined w fifo for transmits serial data 19.3.5 serial mode register (scsmr) the serial mode register (scsmr) specifies the sc if serial communication format and selects the clock source for the baud rate generator. the cpu can always read and write to scsmr. scsmr is initialized to h'0000 by a power-on reset. bit bit name initial value r/w description 15 to 8 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 7 c/ a 0 r/w communication mode selects whether the scif operates in asynchronous or synchronous mode. 0: asynchronous mode 1: synchronous mode
section 19 serial communication interface with fifo (scif) rev. 4.00 sep. 14, 2005 page 692 of 982 rej09b0023-0400 bit bit name initial value r/w description 6 chr 0 r/w character length selects 7-bit or 8-bit data in asynchronous mode. in the synchronous mode, the data length is always eight bits, regardless of the chr setting. 0: 8-bit data 1: 7-bit data * note: * when 7-bit data is selected, the msb (bit 7) of the transmit fifo data register is not transmitted. 5 pe 0 r/w parity enable selects whether to add a parity bit to transmit data and to check the parity of receive data, in asynchronous mode. in synchronous mode, a parity bit is neither added nor checked, regardless of the pe setting. 0: parity bit not added or checked 1: parity bit added and checked * note: * when pe is set to 1, an even or odd parity bit is added to transmit data, depending on the parity mode (o/e ) setting. receive data parity is checked according to the even/odd (o/ e) mode setting.
section 19 serial communication interface with fifo (scif) rev. 4.00 sep. 14, 2005 page 693 of 982 rej09b0023-0400 bit bit name initial value r/w description 4 o/ e 0 r/w parity mode selects even or odd parity when parity bits are added and checked. the o/ e setting is used only in asynchronous mode and only when the parity enable bit (pe) is set to 1 to enable parity addition and checking. the o/ e setting is ignored in synchronous mode, or in asynchronous mode when parity addition and checking is disabled. 0: even parity * 1 1: odd parity* 2 notes: 1. if even parity is selected, the parity bit is added to transmit data to make an even number of 1s in the transmitted character and parity bit combined. receive data is checked to see if it has an even number of 1s in the received character and parity bit combined. 2. if odd parity is selected, the parity bit is added to transmit data to make an odd number of 1s in the transmitted character and parity bit combined. receive data is checked to see if it has an odd number of 1s in the received character and parity bit combined. 3 stop 0 r/w stop bit length selects one or two bits as the stop bit length in asynchronous mode. this setting is used only in asynchronous mode. it is ignored in synchronous mode because no stop bits are added. when receiving, only the first stop bit is checked, regardless of the stop bit setting. if the second stop bit is 1, it is treated as a stop bit, but if the second stop bit is 0, it is treated as the start bit of the next incoming character. 0: one stop bit when transmitting, a single 1-bit is added at the end of each transmitted character. 1: two stop bits when transmitting, two 1 bits are added at the end of each transmitted character.
section 19 serial communication interface with fifo (scif) rev. 4.00 sep. 14, 2005 page 694 of 982 rej09b0023-0400 bit bit name initial value r/w description 2 ? 0 r reserved this bit is always read as 0. the write value should always be 0. 1 0 cks1 cks0 0 0 r/w r/w clock select 1, 0 select the internal clock source of the on-chip baud rate generator. four clock sources are available. p , p /4, p /16 and p /64. for further information on the clock source, bit rate register settings, and baud rate, see section 19.3.8, bit ra te register (scbrr). 00: p 01: p /4 10: p /16 11: p /64 note: p : peripheral clock
section 19 serial communication interface with fifo (scif) rev. 4.00 sep. 14, 2005 page 695 of 982 rej09b0023-0400 19.3.6 serial control register (scscr) the serial control register (scs cr) operates the scif transmit ter/receiver, enables/disables interrupt requests, and selects the transmit/recei ve clock source. the cpu can always read and write to scscr. scscr is initialized to h'0000 by a power-on reset. bit bit name initial value r/w description 15 to 8 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 7 tie 0 r/w transmit interrupt enable enables or disables the transmit-fifo-data-empty interrupt (txi) requested when the serial transmit data is transferred from the transmit fifo data register (scftdr) to the transmit shift register (sctsr), when the quantity of data in t he transmit fifo register becomes less than the specified number of transmission triggers, and when the tdfe flag in the serial status register (scfsr) is set to1. 0: transmit-fifo-data-empty interrupt request (txi) is disabled 1: transmit-fifo-data-empty interrupt request (txi) is enabled * note: * the txi interrupt request can be cleared by writing a greater quantit y of transmit data than the specified transmission trigger number to scftdr and by clearing tdfe to 0 after reading 1 from tdfe, or can be cleared by clearing tie to 0.
section 19 serial communication interface with fifo (scif) rev. 4.00 sep. 14, 2005 page 696 of 982 rej09b0023-0400 bit bit name initial value r/w description 6 rie 0 r/w receive interrupt enable enables or disables the receive-data-full (rxi) interrupts requested when the rdf flag or dr flag in serial status register (scfsr ) is set to1, receive-error (eri) interrupts requested when the er flag in scfsr is set to1, and break (bri) interrupts requested when the brk flag in scfsr or the orer flag in line status register (sclsr) is set to1. 0: receive-data-full interrupt (rxi), receive-error interrupt (eri), and break interrupt (bri) requests are disabled 1: receive-data-full interrupt (rxi), receive-error interrupt (eri), and break interrupt (bri) requests are enabled * note: * rxi interrupt requests can be cleared by reading the dr or rdf flag after it has been set to 1, then clearing the flag to 0, or by clearing rie to 0. eri or bri interrupt requests can be cleared by reading the er, br or orer flag after it has been set to 1, then clearing the flag to 0, or by clearing rie and reie to 0. 5 te 0 r/w transmit enable enables or disables the scif serial transmitter. 0: transmitter disabled 1: transmitter enabled * note: * serial transmission starts after writing of transmit data into scftdr. select the transmit format in scsmr and scfcr and reset the transmit fifo before setting te to 1.
section 19 serial communication interface with fifo (scif) rev. 4.00 sep. 14, 2005 page 697 of 982 rej09b0023-0400 bit bit name initial value r/w description 4 re 0 r/w receive enable enables or disables the scif serial receiver. 0: receiver disabled * 1 1: receiver enabled * 2 notes: 1. clearing re to 0 does not affect the receive flags (dr, er, brk, rdf, fer, per, and orer). these flags retain their previous values. 2. serial reception starts when a start bit is detected in asynchronous mode, or synchronous clock input is detected in synchronous mode. select the receive format in scsmr and scfcr and reset the receive fifo before setting re to 1. 3 reie 0 r receive error interrupt enable enables or disables the receive-error (eri) interrupts and break (bri) interrupts. the setting of reie bit is valid only when rie bit is set to 0. 0: receive-error interrupt (eri) and break interrupt (bri) requests are disabled 1: receive-error interrupt (eri) and break interrupt (bri) requests are enabled * note: * eri or bri interrupt requests can be cleared by reading the er, br or orer flag after it has been set to 1, then clearing the flag to 0, or by clearing rie and reie to 0. even if rie is set to 0, when reie is set to 1, eri or bri interrupt requests are enabled. set so if scif wants to inform intc of eri or bri interrupt requests during dma transfer.
section 19 serial communication interface with fifo (scif) rev. 4.00 sep. 14, 2005 page 698 of 982 rej09b0023-0400 bit bit name initial value r/w description 2 ? 0 r reserved this bit is always read as 0. the write value should always be 0. 1 0 cke1 cke0 0 0 r/w r/w clock enable 1, 0 select the scif clock source and enable or disable clock output from the sck pin. depending on the combination of cke1 and cke0, the sck pin can be used for serial clock output or serial clock input. if the serial clock output is set in synchronous mode, the communication mode bit (c/ a) in scsmr2 is set to 1, and then cke1 and cke0 bits are set. ? asynchronous mode 00: internal clock, sck pin used for input pin (input signal is ignored) 01: internal clock, sck pin used for clock output ( the output clock frequency is 16 times the bit rate. ) 10: external clock, sck pin used for clock input ( the input clock frequency is 16 times the bit rate. ) 11: setting prohibited ? synchronous mode 00: internal clock, sck pin used for serial clock output 01: internal clock, sck pin used for serial clock output 10: external clock, sck pin used for serial clock input 11: setting prohibited
section 19 serial communication interface with fifo (scif) rev. 4.00 sep. 14, 2005 page 699 of 982 rej09b0023-0400 19.3.7 serial status register (scfsr) the serial status register (scfsr) is a 16-bit re gister. the upper 8 bits indicate the number of receives errors in the scfrdr data, and the lower 8 bits indicate the status flag indicating scif operating state. the cpu can always read and write to scfsr, but cannot write 1 to the status flags (er, tend, tdfe, brk, rdf, and dr). these fl ags can be cleared to 0 only if they have first been read (after being set to 1). bits 3 (fer) and 2 (per) are read-only bits that cannot be written. scfsr is initialized to h'0060 by a power-on reset. bit bit name initial value r/w description 15 14 13 12 per3 per2 per1 per0 0 0 0 0 r r r r number of parity errors indicate the quantity of data including a parity error in the receive data stored in the receive fifo data register (scfrdr). the value indicated by bits 15 to 12 represents the number of parity errors in scfrdr. when parity errors have occurred in all 16-byte receive data in scfrdr, per3 to per0 show 0. 11 10 9 8 fer3 fer2 fer1 fer0 0 0 0 0 r r r r number of framing errors indicate the quantity of dat a including a framing error in the receive data stored in scfrdr. the value indicated by bits 11 to 8 represents the number of framing errors in scfrdr. when framing errors have occurred in all 16-byte receive data in scfrdr, fer3 to fer0 show 0.
section 19 serial communication interface with fifo (scif) rev. 4.00 sep. 14, 2005 page 700 of 982 rej09b0023-0400 bit bit name initial value r/w description 7 er 0 r/(w) * receive error indicates the occurrence of a framing error, or of a parity error when receiving data that includes parity. * 1 0: receiving is in progress or has ended normally [clearing conditions] ? er is cleared to 0 a power-on reset ? er is cleared to 0 when the chip is when 0 is written after 1 is read from er 1: a framing error or parity error has occurred. [setting conditions] ? er is set to 1 when the stop bit is 0 after checking whether or not the last stop bit of the received data is 1 at the end of one data receive operation * 2 ? er is set to 1 when the total number of 1s in the receive data plus parity bit does not match the even/odd parity specified by the o/ e bit in scsmr notes: 1. clearing the re bit to 0 in scscr does not affect the er bit, which retains its previous value. even if a receive error occurs, the receive data is transferred to scfrdr and the receive operation is continued. whether or not the data read from scrdr includes a receive error can be detected by the fer and per bits in scfsr. 2. in two stop bits mode, only the first stop bit is checked; the second stop bit is not checked.
section 19 serial communication interface with fifo (scif) rev. 4.00 sep. 14, 2005 page 701 of 982 rej09b0023-0400 bit bit name initial value r/w description 6 tend 0 r/(w) * transmit end indicates that when the last bit of a serial character was transmitted, scftdr did not contain valid data, so transmission has ended. 0: transmission is in progress [clearing condition] ? tend is cleared to 0 when 0 is written after 1 is read from tend after transmit data is written in scftdr 1: end of transmission [setting conditions] ? tend is set to 1 when the chip is a power-on reset ? tend is set to 1 when te is cleared to 0 in the serial control register (scscr) ? tend is set to 1 when scftdr does not contain receive data when the last bit of a one-byte serial character is transmitted note: when the transmit fifo data empty dma transfer request is generated and transmit data is written to scftdr by the dmac, do not use this flag as a transmit end flag.
section 19 serial communication interface with fifo (scif) rev. 4.00 sep. 14, 2005 page 702 of 982 rej09b0023-0400 bit bit name initial value r/w description 5 tdfe 0 r/(w) * transmit fifo data empty indicates that data has been transferred from the transmit fifo data register (scftdr) to the transmit shift register (sctsr), the quantity of data in scftdr has become less than the transmission trigger number specified by the ttrg1 and ttrg0 bits in the fifo control register (scfcr), and writing of transmit data to scftdr is enabled. 0: the quantity of transmit data written to scftdr is greater than the specified transmission trigger number [clearing conditions] ? tdfe is cleared to 0 when data exceeding the specified transmission trigger number is written to scftdr after 1 is read from tdfe and then 0 is written ? tdfe is cleared to 0 when dmac write data exceeding the specified transmission trigger number to scftdr 1: the quantity of transmit data in scftdr is less than the specified transmission trigger number * [setting conditions] ? tdfe is set to 1 by a power-on reset ? tdfe is set to 1 when the quantity of transmit data in scftdr becomes less than the specified transmission trigger number as a result of transmission note: * since scftdr is a 16-byte fifo register, the maximum quantity of data that can be written when tdfe is 1 is "16 minus the specified transmission trigger number". if an attempt is made to write additional data, the data is ignored. the quantity of data in scftdr is indicated by the upper 8 bits of scfdr.
section 19 serial communication interface with fifo (scif) rev. 4.00 sep. 14, 2005 page 703 of 982 rej09b0023-0400 bit bit name initial value r/w description 4 brk 0 r/(w) * break detection indicates that a break signal has been detected in receive data. 0: no break signal received [clearing conditions] ? brk is cleared to 0 when the chip is a power-on reset ? brk is cleared to 0 when software reads brk after it has been set to 1, then writes 0 to brk 1: break signal received * [setting condition] ? brk is set to 1 when data including a framing error is received, and a framing error occurs with space 0 in the subsequent receive data note: * when a break is detected, transfer of the receive data (h'00) to scfrdr stops after detection. when the break ends and the receive signal becomes mark 1, the transfer of receive data resumes. 3 fer 0 r framing error indicates a framing error in the data read from the next receive fifo data register (scfrdr) in asynchronous mode. 0: no receive framing error occurred in the next data read from scfrdr [clearing conditions] ? fer is cleared to 0 when the chip undergoes a power-on reset ? fer is cleared to 0 when no framing error is present in the next data read from scfrdr 1: a receive framing error occurred in the next data read from scfrdr. [setting condition] ? fer is set to 1 when a framing error is present in the next data read from scfrdr
section 19 serial communication interface with fifo (scif) rev. 4.00 sep. 14, 2005 page 704 of 982 rej09b0023-0400 bit bit name initial value r/w description 2 per 0 r parity error indicates a parity error in the data read from the next receive fifo data register (scfrdr) in asynchronous mode. 0: no receive parity error occurred in the next data read from scfrdr [clearing conditions] ? per is cleared to 0 when the chip undergoes a power-on reset ? per is cleared to 0 when no parity error is present in the next data read from scfrdr 1: a receive parity error occurred in the data read from scfrdr [setting condition] ? per is set to 1 when a parity error is present in the next data read from scfrdr
section 19 serial communication interface with fifo (scif) rev. 4.00 sep. 14, 2005 page 705 of 982 rej09b0023-0400 bit bit name initial value r/w description 1 rdf 0 r/(w) * receive fifo data full indicates that receive data has been transferred to the receive fifo data register (scfrdr), and the quantity of data in scf rdr has become more than the receive trigger number specified by the rtrg1 and rtrg0 bits in the fi fo control register (scfcr). 0: the quantity of transmit data written to scfrdr is less than the specified receive trigger number [clearing conditions] ? rdf is cleared to 0 by a power-on reset, standby mode ? rdf is cleared to 0 when the scfrdr is read until the quantity of receive data in scfrdr becomes less than the specified receive trigger number after 1 is read from rdf and then 0 is written ? rdf is cleared to 0 when dmac read scfrdr until the quantity of receive data in scfrdr becomes less than the specified receive trigger number 1: the quantity of receiv e data in scfrdr is more than the specified receive trigger number [setting condition] ? rdf is set to 1 when a quantity of receive data more than the specified receive trigger number is stored in scfrdr * note: * scftdr is a 16-byte fifo register. when rdf is 1, the specified receive trigger number of data can be read. if an attempt is made to read after all the data in scfrdr has been read, the dat a is undefined. the quantity of receive data in scfrdr is indicated by the lower 8 bits of scfdr.
section 19 serial communication interface with fifo (scif) rev. 4.00 sep. 14, 2005 page 706 of 982 rej09b0023-0400 bit bit name initial value r/w description 0 dr 0 r/(w) * receive data ready indicates that the quantity of data in the receive fifo data register (scfrdr) is less than the specified receive trigger number, and that the next data has not yet been received after the elapse of 15 etu from the last stop bit in asynchronous mode. in clock synchronous mode, this bit is not set to 1. 0: receiving is in progress, or no receive data remains in scfrdr after receiving ended normally [clearing conditions] ? dr is cleared to 0 when the chip undergoes a power-on reset ? dr is cleared to 0 when all receive data are read after 1 is read from dr and then 0 is written ? dr is cleared to 0 when all receive data are read by dmac 1: next receive data has not been received [setting condition] ? dr is set to 1 when scfrdr contains less data than the specified receiv e trigger number, and the next data has not yet been received after the elapse of 15 etu from the last stop bit. * note: * this is equivalent to 1.5 frames with the 8-bit, 1-stop-bit format. (etu: elementary time unit) note: * the only value that can be writ ten is 0 to clear the flag.
section 19 serial communication interface with fifo (scif) rev. 4.00 sep. 14, 2005 page 707 of 982 rej09b0023-0400 19.3.8 bit rate register (scbrr) the bit rate register (scbrr) is an 8-bit register that, together with the baud rate generator clock source selected by the cks1 and cks0 bits in th e serial mode register (scsmr), determines the serial transmit/receive bit rate. the cpu can always read and write to scbrr. s cbrr is initialized to h'ff by a power-on reset. each channel has independent baud rate generator control, so different values can be set in three channels. the scbrr setting is calculated as follows: ? asynchronous mode: n = 10 6 - 1 64 2 2n-1 b p ? synchronous mode: n = 10 6 - 1 8 2 2n-1 b p b: bit rate (bits/s) n: scbrr setting for baud rate generator (0 n 255) p : operating frequency for peripheral modules (mhz) n: baud rate generator clock source (n = 0, 1, 2, 3) (for the clock sources and values of n, see table 19.2.) table 19.2 scsmr settings scsmr settings n clock source cks1 cks0 0 p 0 0 1 p /4 0 1 2 p /16 1 0 3 p /64 1 1 note: the bit rate error in asynchro nous is given by the following formula: error (%) = - 1 100 (n + 1) b 64 2n-1 2 p 10 6
section 19 serial communication interface with fifo (scif) rev. 4.00 sep. 14, 2005 page 708 of 982 rej09b0023-0400 table 19.3 lists examples of scbrr settings in as ynchronous mode, and table 19.4 lists examples of scbrr settings in synchronous mode. table 19.3 bit rates and scbrr settings in asynchronous mode p (mhz) 5 6 6.144 bit rate (bits/s) n n error ( % ) n n error ( % ) n n error ( % ) 110 2 88 ? 0.25 2 106 ? 0.44 2 108 0.08 150 2 64 0.16 2 77 0.16 2 79 0.00 300 1 129 0.16 1 155 0.16 1 159 0.00 600 1 64 0.16 1 77 0.16 1 79 0.00 1200 0 129 0.16 0 155 0.16 0 159 0.00 2400 0 64 0.16 0 77 0.16 0 79 0.00 4800 0 32 ? 1.36 0 38 0.16 0 39 0.00 9600 0 15 1.73 0 19 ? 2.34 0 19 0.00 19200 0 7 1.73 0 9 ? 2.34 0 9 0.00 31250 0 4 0.00 0 5 0.00 0 5 2.40 38400 0 3 1.73 0 4 ? 2.34 0 4 0.00 p (mhz) 7.3728 8 9.8304 bit rate (bits/s) n n error ( % ) n n error ( % ) n n error ( % ) 110 2 130 ?0.07 2 141 0.03 2 174 ?0.26 150 2 95 0.00 2 103 0.16 2 127 0.00 300 1 191 0.00 1 207 0.16 1 255 0.00 600 1 95 0.00 1 103 0.16 1 127 0.00 1200 0 191 0.00 0 207 0.16 0 255 0.00 2400 0 95 0.00 0 103 0.16 0 127 0.00 4800 0 47 0.00 0 51 0.16 0 63 0.00 9600 0 23 0.00 0 25 0.16 0 31 0.00 19200 0 11 0.00 0 12 0.16 0 15 0.00 31250 0 6 5.33 0 7 0.00 0 9 ?1.70 38400 0 5 0.00 0 6 ?6.99 0 7 0.00
section 19 serial communication interface with fifo (scif) rev. 4.00 sep. 14, 2005 page 709 of 982 rej09b0023-0400 p (mhz) 10 12 12.288 14.7456 bit rate (bits/s) n n error (% ) n n error (% ) n n error (% ) n n error (% ) 110 2 177 ?0.25 2 212 0.03 2 217 0.08 3 64 0.70 150 2 129 0.16 2 155 0.16 2 159 0.00 2 191 0.00 300 2 64 0.16 2 77 0.16 2 79 0.00 2 95 0.00 600 1 129 0.16 1 155 0.16 1 159 0.00 1 191 0.00 1200 1 64 0.16 1 77 0.16 1 79 0.00 1 95 0.00 2400 0 129 0.16 0 155 0.16 0 159 0.00 0 191 0.00 4800 0 64 0.16 0 77 0.16 0 79 0.00 0 95 0.00 9600 0 32 ?1.36 0 38 0.16 0 39 0.00 0 47 0.00 19200 0 15 1.73 0 19 0.16 0 19 0.00 0 23 0.00 31250 0 9 0.00 0 11 0.00 0 11 2.40 0 14 ?1.70 38400 0 7 1.73 0 9 ?2.34 0 9 0.00 0 11 0.00 p (mhz) 16 19.6608 20 24 bit rate (bits/s) n n error (% ) n n error (% ) n n error (% ) n n error (% ) 110 3 70 0.03 3 86 0.31 3 88 ?0.25 3 106 ?0.44 150 2 207 0.16 2 255 0.00 3 64 0.16 3 77 0.16 300 2 103 0.16 2 127 0.00 2 129 0.16 2 155 0.16 600 1 207 0.16 1 255 0.00 2 64 0.16 2 77 0.16 1200 1 103 0.16 1 127 0.00 1 129 0.16 1 155 0.16 2400 0 207 0.16 0 255 0.00 1 64 0.16 1 77 0.16 4800 0 103 0.16 0 127 0.00 0 129 0.16 0 155 0.16 9600 0 51 0.16 0 63 0.00 0 64 0.16 0 77 0.16 19200 0 25 0.16 0 31 0.00 0 32 ?1.36 0 38 0.16 31250 0 15 0.00 0 19 ?1.70 0 19 0.00 0 23 0.00 38400 0 12 0.16 0 15 0.00 0 15 1.73 0 19 ?2.34
section 19 serial communication interface with fifo (scif) rev. 4.00 sep. 14, 2005 page 710 of 982 rej09b0023-0400 p (mhz) 24.576 28.7 30 33 bit rate (bits/s) n n error (% ) n n error (% ) n n error (% ) n n error (% ) 110 3 108 0.08 3 126 0.31 3 132 0.13 3 145 0.33 150 3 79 0.00 3 92 0.46 3 97 ?0.35 3 106 0.39 300 2 159 0.00 2 186 ?0.08 2 194 0.16 2 214 -0.07 600 2 79 0.00 2 92 0.46 2 97 ?0.35 2 106 0.39 1200 1 159 0.00 1 186 ?0.08 1 194 0.16 1 214 -0.07 2400 1 79 0.00 1 92 0.46 1 97 ?0.35 1 106 0.39 4800 0 159 0.00 0 186 ?0.08 0 194 ?1.36 0 214 -0.07 9600 0 79 0.00 0 92 0.46 0 97 ?0.35 0 106 0.39 19200 0 39 0.00 0 46 ?0.61 0 48 ?0.35 0 53 -0.54 31250 0 24 ?1.70 0 28 ?1.03 0 29 0.00 0 32 0.00 38400 0 19 0.00 0 22 1.55 0 23 1.73 0 26 -0.54 note: settings with an error of 1% or less are recommended.
section 19 serial communication interface with fifo (scif) rev. 4.00 sep. 14, 2005 page 711 of 982 rej09b0023-0400 table 19.4 bit rates and scbrr settings in synchronous mode p (mhz) 5 8 16 28.7 30 33 bit rate (bits/s) n n n n n n n n n n n n 110 ? ? ? ? ? ? ? ? ? ? ? ? 250 3 77 3 124 3 249 ? ? ? ? ? ? 500 3 38 2 249 3 124 3 223 3 233 3 255 1k 2 77 2 124 2 249 3 111 3 116 3 125 2.5k 1 124 1 199 2 99 2 178 2 187 2 200 5k 0 249 1 99 1 199 2 89 2 93 2 100 10k 0 124 0 199 1 99 1 178 1 187 1 200 25k 0 49 0 79 0 159 1 71 1 74 1 80 50k 0 24 0 39 0 79 0 143 0 149 0 160 100k ? ? 0 19 0 39 0 71 0 74 0 80 250k 0 4 0 7 0 15 ? ? 0 29 0 31 500k ? ? 0 3 0 7 ? ? 0 14 0 15 1m ? ? ? ? 0 3 ? ? ? ? 0 7 2m ? ? ? ? ? ? ? ? ? ? [legend] blank: no setting possible ?: setting possible, but error occurs note: set the brr value that satisf ies the external specifications.
section 19 serial communication interface with fifo (scif) rev. 4.00 sep. 14, 2005 page 712 of 982 rej09b0023-0400 table 19.5 indicates the maximum bit rates in asynchronous mode when the baud rate generator is used. tables 19.6 and 19.7 list the maximum rates for external clock input. table 19.5 maximum bit rates for variou s frequencies with baud rate generator (asynchronous mode) settings p (mhz) maximum bit rate (bits/s) n n 5 156250 0 0 4.9152 153600 0 0 8 250000 0 0 9.8304 307200 0 0 12 375000 0 0 14.7456 460800 0 0 16 500000 0 0 19.6608 614400 0 0 20 625000 0 0 24 750000 0 0 24.576 768000 0 0 28.7 896875 0 0 30 937500 0 0 33 1031250 0 0
section 19 serial communication interface with fifo (scif) rev. 4.00 sep. 14, 2005 page 713 of 982 rej09b0023-0400 table 19.6 maximum bit rates with external clock input (asynchronous mode) p (mhz) external input clock (mh z) maximum bit rate (bits/s) 5 1.2500 78125 4.9152 1.2288 76800 8 2.0000 125000 9.8304 2.4576 153600 12 3.0000 187500 14.7456 3.6864 230400 16 4.0000 250000 19.6608 4.9152 307200 20 5.0000 312500 24 6.0000 375000 24.576 6.1440 384000 28.7 7.1750 448436 30 7.5000 468750 33 8.25 515625 table 19.7 maximum bit rates with exte rnal clock input (synchronous mode) p (mhz) external input clock (mh z) maximum bit rate (bits/s) 5 0.8333 833333.3 8 1.3333 1333333.3 16 2.6667 2666666.7 24 4.0000 4000000.0 28.7 4.7833 4783333.3 30 5.0000 5000000.0 33 5.5000 5500000.0
section 19 serial communication interface with fifo (scif) rev. 4.00 sep. 14, 2005 page 714 of 982 rej09b0023-0400 19.3.9 fifo control register (scfcr) the fifo control register (scfcr) resets the quantity of data in the transmit and receive fifo registers, sets the trigger data quantity, and contains an enable bit for loop-back testing. scfcr can always be read and written to by the cpu. it is initialized to h'0000 by a power-on reset. bit bit name initial value r/w description 15 to 11 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 10 9 8 rstrg2 rstrg1 rstrg0 0 0 0 r/w r/w r/w rts output active trigger when the quantity of receive data in receive fifo register (scfrdr) becomes more than the number shown below, rts signal is set to high. 000: 15 001: 1 010: 4 011: 6 100: 8 101: 10 110: 12 111: 14 note: set the trigger number to 1 when the receive data is transferred by the dmac in synchronous mode. if the set trigger number is other than 1, the receive data remains in scfrdr should be read by the cpu.
section 19 serial communication interface with fifo (scif) rev. 4.00 sep. 14, 2005 page 715 of 982 rej09b0023-0400 bit bit name initial value r/w description receive fifo data trigger set the quantity of receive data which sets the receive data full (rdf) flag in the serial status register (scfsr). the rdf flag is set when the quantity of receive data stored in the receive fifo register (scfrdr) is increased more than the set trigger number shown below. ? asynchronous mode ? synchronous mode 7 6 rtrg1 rtrg0 0 0 r/w r/w 00: 1 01: 4 10: 8 11: 14 00: 1 01: 2 10: 8 11: 14 5 4 ttrg1 ttrg0 0 0 r/w r/w transmit fifo data trigger 1, 0 set the quantity of remaining transmit data which sets the transmit fifo data register empty (tdfe) flag in the serial status register (scfsr). the tdfe flag is set when the quantity of transmit data in the transmit fifo data register (scftdr) becomes less than the set trigger number shown below. 00: 8 (8) * 01: 4 (12) * 10: 2 (14) * 11: 0 (16) * note: * values in parentheses mean the number of empty bytes in scftdr when the tdfe flag is set to 1. 3 mce 0 r/w modem control enable enables modem control signals cts and rts . in synchronous mode, mce bit should always be 0. 0: modem signal disabled * 1: modem signal enabled note: * cts is fixed at active 0 regardless of the input value, and rts is also fixed at 0.
section 19 serial communication interface with fifo (scif) rev. 4.00 sep. 14, 2005 page 716 of 982 rej09b0023-0400 bit bit name initial value r/w description 2 tfrst 0 r/w transmit fifo data register reset disables the transmit data in the transmit fifo data register and resets the data to the empty state. 0: reset operation disabled * 1: reset operation enabled note: * reset operation is executed by a power-on reset. 1 rfrst 0 r/w receive fifo data register reset disables the receive data in the receive fifo data register and resets the data to the empty state. 0: reset operation disabled * 1: reset operation enabled note: * reset operation is executed by a power-on reset. 0 loop 0 r/w loop-back test internally connects the transmit output pin (txd) and receive input pin (rxd) and enables loop-back testing. 0: loop back test disabled 1: loop back test enabled
section 19 serial communication interface with fifo (scif) rev. 4.00 sep. 14, 2005 page 717 of 982 rej09b0023-0400 19.3.10 fifo data count register (scfdr) scfdr is a 16-bit register which indicates the qu antity of data stored in the transmit fifo data register (scftdr) and the receive fifo data register (scfrdr). it indicates the quantity of transmit data in scftdr with the upper 8 bits, an d the quantity of receive data in scfrdr with the lower 8 bits. scfdr can always be read by the cpu. scfdr is initialized to h'0000 by a power on reset. bit bit name initial value r/w description 15 to 13 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 12 11 10 9 8 t4 t3 t2 t1 t0 0 0 0 0 0 r r r r r t4 to t0 bits indicate the quantity of non-transmitted data stored in scftdr. h'00 means no transmit data, and h'10 means that scftdr is full of transmit data. 7 to 5 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 4 3 2 1 0 r4 r3 r2 r1 r0 0 0 0 0 0 r r r r r r4 to r0 bits indicate the quantity of receive data stored in scfrdr. h'00 me ans no receive data, and h'10 means that scfrdr full of receive data. 19.3.11 serial port register (scsptr) the serial port register (scsptr) controls input/output and data of pins multiplexed to scif function. bits 1 and 0 can input data from rxd pin and output data to txd pin, so they control break of serial transmitting/receiving. bits 3 and 2 can control input/output data of sck pin, bits 5 and 4 can control input/output data of cts pin, and bits 7 and 6 can control input/output data of rts pin. the cpu can always read and write to scsptr. scsptr is initialized to h'0050 by a power-on reset.
section 19 serial communication interface with fifo (scif) rev. 4.00 sep. 14, 2005 page 718 of 982 rej09b0023-0400 bit bit name initial value r/w description 15 to 8 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 7 rtsio 0 r/w rts port input/output indicates the input or output of rts pin. when rts pin is used as port outputting the rtsdt bit, the mce bit of fifo control register (scfcr) should be set to 0. 0: not output the rtsdt bit to rts pin 1: output the rtsdt bit to rts pin 6 rtsdt 1 r/w rts port data indicates the data of rts pin used as port. input/output is specified by rtsio bit. when output, the value of rtsdt bit is outputted to rts pin. whenever input or output, rts pin status is read from rtsdt bit. however port function of pfc (pin function controller) must be set to rts input/output. 0: input/output data is low level 1: input/output dat a is high level 5 ctsio 0 r/w cts port input/output indicates the input or output of cts pin. when cts pin is used as port outputting the ctsdt bit, the mce bit of fifo control register (scfcr) should be set to 0. 0: not output the ctsdt bit to cts pin 1: output the ctsdt bit to cts pin 4 ctsdt 1 r/w cts port data indicates the data of cts pin used as port. input/output is specified by ctsio bit. when output, the value of ctsdt bit is outputted to cts pin. whenever input or output, cts pin status is read from ctsdt bit. however port function of pfc (pin function controller) must be set to cts input/output. 0: input/output data is low level 1: input/output dat a is high level
section 19 serial communication interface with fifo (scif) rev. 4.00 sep. 14, 2005 page 719 of 982 rej09b0023-0400 bit bit name initial value r/w description 3 sckio 0 r/w sck port input/output indicates the input or output of sck pin. when sck pin is used as port outputting the sckdt bit, the cke1, cke0 bit of serial control register (scscr) should be set to 0. 0: not output the sckdt bit to sck pin 1: output the sckdt bit to sck pin 2 sckdt 0 r/w sck port data indicates the data of sck pin used as port. input/output is specified by sckio bit. when output, the value of sckdt bit is outputted to sck pin. whenever input or output, sck pin status is read from sckdt bit. however port function of pfc (pin function controller) must be set to sck input/output. 0: input/output data is low level 1: input/output dat a is high level 1 spb2io 0 r/w serial port break input/output indicates the input or outpu t of txd pin. when txd pin is used as port outputting the spb2dt bit, the te bit of serial control register (scscr) should be set to 0. 0: not output the spb2dt bit to txd pin 1: output the spb2dt bit to txd pin 0 spb2dt 0 r/w serial port break data indicates the input data of rxd pin and the output data of txd pin used as port. output of txd pin is specified by spb2io bit. when output, the value of spb2dt bit is outputted to txd pin. whenever input or output, rxd pin status is read from spb2dt bit. however port function of pfc (pin function controller) must be set to txd output and rxd input. 0: input/output data is low level 1: input/output dat a is high level
section 19 serial communication interface with fifo (scif) rev. 4.00 sep. 14, 2005 page 720 of 982 rej09b0023-0400 19.3.12 line status register (sclsr) the cpu can always read or write to sclsr, but cannot write 1 to the or er flag. this flag can be cleared to 0 only if it has first been read (after being set to 1). sclsr is initialized to h'0000 by a power-on reset. bit bit name initial value r/w description 15 to 1 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 0 orer 0 r/(w) * overrun error indicates the occurrence of an overrun error. 0: receiving is in progress or has ended normally * 1 [clearing conditions] ? orer is cleared to 0 when the chip is a power-on reset ? orer is cleared to 0 when 0 is written after 1 is read from orer. 1: an overrun error has occurred * 2 [setting condition] ? orer is set to 1 when the next serial receiving is finished while the receive fifo is full of 16-byte receive data. notes: 1. clearing the re bit to 0 in scscr does not affect the orer bit, which retains its previous value. 2. the receive fifo data register (scfrdr) hold the data before an overrun error is occurred, and the next receive data is extinguished. when orer is set to 1, scif cannot continue the next serial receiving. note: * the only value that can be writ ten is 0 to clear the flag.
section 19 serial communication interface with fifo (scif) rev. 4.00 sep. 14, 2005 page 721 of 982 rej09b0023-0400 19.4 operation 19.4.1 overview for serial communication, th e scif has an asynchronous mode in which characters are synchronized individually, and a synchronous mode in which communication is synchronized with clock pulses. the scif has a 16-byte fifo bu ffer for both transmit a nd receive operations, reducing the overhead of the cpu, and enabling continuous high-speed communication. moreover, it has rts and cts signals as modem control signals. the transmission format is selected in the serial mode register (scsmr ). the scif clock source is selected by the combination of the cke1 and cke0 bits in the serial control register (scscr). asynchronous mode: ? data length is selectable: 7 or 8 bits ? parity bit is selectable. so is the stop bit length (1 or 2 bits). the combination of the preceding selections constitutes the communication format and character length. ? in receiving, it is possible to detect framing er rors, parity errors, r eceive fifo data full, overrun errors, receive data ready, and breaks. ? the number of stored data bytes is indicated fo r both the transmit and receive fifo registers. ? an internal or external clock can be selected as the scif clock source. ? when an internal clock is selected, the sc if operates using the on-chip baud rate generator. ? when an external clock is selected, the external clock input must have a frequency 16 times the bit rate. (the on-chip baud rate generator is not used.) synchronous mode: ? the transmission/reception format has a fixed 8-bit data length. ? in receiving, it is possible to detect overrun errors (orer). ? an internal or external clock can be selected as the scif clock source. ? when an internal clock is selected, the sc if operates using the on-chip baud rate generator, and outputs a serial clock signal to external devices. ? when an external clock is selected, the scif operates on the input serial clock. the on- chip baud rate generator is not used.
section 19 serial communication interface with fifo (scif) rev. 4.00 sep. 14, 2005 page 722 of 982 rej09b0023-0400 table 19.8 scsmr settings and scif communication formats scsmr settings scif communication format bit 7 c/ a bit 6 chr bit 5 pe bit 3 stop mode data length pari ty bit stop bit length 0 0 0 0 8 bits not set 1 bit 1 2 bits 1 0 set 1 bit 1 2 bits 1 0 0 7 bits not set 1 bit 1 2 bits 1 0 set 1 bit 1 asynchronous 2 bits 1 * * * synchronous 8 bits not set none note: *: don't care table 19.9 scsmr and scscr setting s and scif clock source selection scsmr scscr settings scif transmit/receive clock bit 7 c/ a bit 1 cke1 bit 0 cke0 mode clock source sck pin function 0 0 0 internal scif does not use the sck pin 1 outputs a clock with a frequency 16 times the bit rate 1 0 asynchronous external inputs a clock with frequency 16 times the bit rate 1 0 * internal outputs the serial clock 1 0 synchronous external inputs the serial clock note: *: don't care
section 19 serial communication interface with fifo (scif) rev. 4.00 sep. 14, 2005 page 723 of 982 rej09b0023-0400 19.4.2 operation in asynchronous mode in asynchronous mode, each transmitted or received ch aracter begins with a start bit and ends with a stop bit. serial comm unication is synchronized one character at a time. the transmitting and receiving sections of th e scif are independent, so full duplex communication is possible. the tr ansmitter and receiver are 16-byte fifo buffered, so data can be written and read while transmitting and receiving are in progress, enabling continuou s transmitting and receiving. figure 19.2 shows the general format of asyn chronous serial communi cation. in asynchronous serial communication, the communicatio n line is normally held in the mark (high) state. the scif monitors the line and starts serial communicati on when the line goes to the space (low) state, indicating a start bit. one serial ch aracter consists of a start bit (low), data (lsb first), parity bit (high or low), and stop bit (high), in that order. when receiving in asynchronous mode , the scif synchronizes at the falling edge of the start bit. the scif samples each data bit on the eighth pulse of a clock with a frequency 16 times the bit rate. receive data is latched at the center of each bit. lsb start bit msb idle state (mark state) stop bit 0 transmit/receive data d0 d1 d2 d3 d4 d5 d6 d7 0/1 1 1 1 1 serial data parity bit 1 bit 1 or 2 bits 7 or 8 bits 1 bit or none one unit of transfer data (character or frame) figure 19.2 example of data form at in asynchronous communication (8-bit data with parity and two stop bits)
section 19 serial communication interface with fifo (scif) rev. 4.00 sep. 14, 2005 page 724 of 982 rej09b0023-0400 transmit/receive formats: table 19.10 lists the 8 communicati on formats that can be selected in asynchronous mode. the format is selected by settings in the serial mode register (scsmr). table 19.10 serial communication formats (asynchronous mode) scsmr bits serial transmit /receive format and frame length chr pe stop 1 2 3 4 5 6 7 8 9 10 11 12 0 0 0 start 8-bit data stop 0 0 1 start 8-bit data stop stop 0 1 0 start 8-bit data p stop 0 1 1 start 8-bit data p stop stop 1 0 0 start 7-bit data stop 1 0 1 start 7-bit data stop stop 1 1 0 start 7-bit data p stop 1 1 1 start 7-bit data p stop stop [legend] start: start bit stop: stop bit p: parity bit clock: an internal clock generated by the on-chip baud rate generator or an external clock input from the sck pin can be selected as the scif tr ansmit/receive clock. the clock source is selected by the c/ a bit in the serial mode register (scsmr) and bits cke1 and cke0 in the serial control register (scscr) (table 19.9). when an external clock is input at the sck pin, it must have a frequency equal to 16 times the desired bit rate. when the scif operates on an internal clock, it can output a clock signal at the sck pin. the frequency of this output clock is equal to 16 times the desired bit rate.
section 19 serial communication interface with fifo (scif) rev. 4.00 sep. 14, 2005 page 725 of 982 rej09b0023-0400 transmitting and receiving data: ? scif initialization (asynchronous mode) before transmitting or receiving, clear the te and re bits to 0 in the serial control register (scscr), then initialize the scif as follows. when changing the operation mode or the communication format, always clear the te and re bits to 0 before following the procedure given below. clearing te to 0 initializes the transmit shift register (sctsr). clearing te and re to 0, however, does not initialize the serial status register (scfsr), transmit fifo data register (scftdr), or receive fifo data register (scfrdr), which retain their previous contents. clear te to 0 afte r all transmit data has been transmitted and the tend flag in the scfsr is set. the te bit can be cleared to 0 during transmission, but the transmit data goes to the mark state after the bit is cleared to 0. set the tfrst bit in scfcr to 1 and reset scftdr before te is set again to start transmission. when an external clock is used, the clock should not be stopped during initialization or subsequent operation. scif operation becomes unreliable if the clock is stopped.
section 19 serial communication interface with fifo (scif) rev. 4.00 sep. 14, 2005 page 726 of 982 rej09b0023-0400 figure 19.3 shows a sample flowchart for initializing the scif. start of initialization clear te and re bits in scscr to 0 set tfrst and rfrst bits in scfcr to 1 set cke1 and cke0 bits in scscr (leaving te, re, tie, and rie bits cleared to 0) set data transfer format in scsmr set value in scbrr 1-bit interval elapsed? set rtrg1-0 and ttrg1-0 bits in scfcr, and clear tfrst and rfrst bits to 0 set te and re bits in scscr to 1, and set tie, rie, and reie bits end of initialization wait no yes set the clock selection in scscr. be sure to clear bits tie, rie, te, and re to 0. set the data transfer format in scsmr. write a value corresponding to the bit rate into scbrr. (not necessary if an external clock is used.) wait at least one bit interval, then set the te bit or re bit in scscr to 1. also set the rie, reie, and tie bits. setting the te and re bits enables the txd and rxd pins to be used. when transmitting, the scif will go to the mark state; when receiving, it will go to the idle state, waiting for a start bit. [1] [1] [2] [3] [4] [2] [3] [4] after reading brk, dr, and er flags in scfsr, and each flag in sclsr, write 0 to clear them figure 19.3 sample flowchart for scif initialization
section 19 serial communication interface with fifo (scif) rev. 4.00 sep. 14, 2005 page 727 of 982 rej09b0023-0400 ? transmitting serial da ta (asynchronous mode) figure 19.4 shows a sample flow chart for serial transmission. use the following procedure for serial data transm ission after enabling the scif for transmission. start of transmission read tdfe flag in scfsr tdfe = 1? write transmit data in scftdr, and read 1 from tdfe flag and tend flag in scfsr, then clear to 0 all data transmitted? read tend flag in scfsr tend = 1? break output? clear spb2dt to 0 and set spb2io to 1 clear te bit in scscr to 0 end of transmission no yes no yes no yes no yes [1] scif status check and transmit data write: read scfsr and check that the tdfe flag is set to 1, then write transmit data to scftdr, and read 1 from the tdfe and tend flags, then clear to 0. the number of transmit data bytes that can be written is 16 - (transmit trigger set number). [2] serial transmission continuation procedure: to continue serial transmission, read 1 from the tdfe flag to confirm that writing is possible, then write data to scftdr, and then clear the tdfe flag to 0. [3] break output at the end of serial transmission: to output a break in serial transmission, clear the spb2dt bit to 0 and set the spb2io bit to 1 in scsptr, then clear the te bit in scscr to 0. in [1] and [2], it is possible to ascertain the number of data bytes that can be written from the number of transmit data bytes in scftdr indicated by the upper 8 bits of scfdr. [1] [2] [3] figure 19.4 sample flowchart for transmitting serial data
section 19 serial communication interface with fifo (scif) rev. 4.00 sep. 14, 2005 page 728 of 982 rej09b0023-0400 in serial transmission, the scif operates as described below. 1. when data is written into the transmit fifo data register (scftdr), the scif transfers the data from scftdr to the transmit shift register (sctsr) and starts transmitting. confirm that the tdfe flag in the serial status register (scfsr) is set to 1 before writing transmit data to scftdr. the number of data bytes that can be written is (16 ? transmit trigger setting). 2. when data is transferred from scftdr to sctsr and transmission is started, consecutive transmit operations are performed until there is no transmit data left in scftdr. when the number of transmit data bytes in scftdr falls below the transmit trigger number set in the fifo control register (scfcr), the tdfe flag is set. if the tie bit in the serial control register (scsr) is set to 1 at this time, a tr ansmit-fifo-data-empty interrupt (txi) request is generated. the serial transmit data is sent from the txd pin in the following order. a. start bit: one-bit 0 is output. b. transmit data: 8-bit or 7-bit data is output in lsb-first order. c. parity bit: one parity bit (even or odd parity) is output. (a format in which a parity bit is not output can also be selected.) d. stop bit(s): one or two 1 bits (stop bits) are output. e. mark state: 1 is output continuously until the start bit that starts the next transmission is sent. 3. the scif checks the scftdr transmit data at th e timing for sending the stop bit. if data is present, the data is transferred from scftdr to sctsr, the stop bit is sent, and then serial transmission of the next frame is started. if th ere is no transmit data, the tend flag in scfsr is set to 1, the stop bit is sent, and then the line goes to the mark state in which 1 is output continuously.
section 19 serial communication interface with fifo (scif) rev. 4.00 sep. 14, 2005 page 729 of 982 rej09b0023-0400 figure 19.5 shows an example of the operation for transmission. 1 0 d0 d1 d7 0/1 1 0 d0 d1 d7 0/1 1 1 tdfe tend serial data start bit data parity bit stop bit start bit idle state (mark state) data parity bit stop bit txi interrupt request data written to scftdr and tdfe flag read as 1 then cleared to 0 by txi interrupt handler one frame txi interrupt request figure 19.5 example of transmit operation (8-bit data, parity, one stop bit) 4. when modem control is enabled, transmission can be stopped and rest arted in accordance with the cts input value. when cts is set to 1, if transmission is in progress, the line goes to the mark state after transmission of one frame. when cts is set to 0, the next transmit data is output starting from the start bit. figure 19.6 shows an example of the operation when modem control is used. serial data txd 0 d0 d1 d7 0/1 0 1 d0 d1 d7 0/1 cts drive high before stop bit start bit parity bit stop bit start bit figure 19.6 example of op eration using modem control ( cts )
section 19 serial communication interface with fifo (scif) rev. 4.00 sep. 14, 2005 page 730 of 982 rej09b0023-0400 ? receiving serial data (asynchronous mode) figures 19.7 and 19.8 show a sample flowchart for serial reception. use the following procedure for serial data r eception after enabling th e scif for reception. start of reception read er, dr, brk flags in scfsr and orer flag in sclsr er, dr, brk or orer = 1? read rdf flag in scfsr rdf = 1? read receive data in scfrdr, and clear rdf flag in scfsr to 0 all data received? clear re bit in scscr to 0 end of reception yes no yes yes no no error handling [1] receive error handling and break detection: read the dr, er, and brk flags in scfsr, and the orer flag in sclsr, to identify any error, perform the appropriate error handling, then clear the dr, er, brk, and orer flags to 0. in the case of a framing error, a break can also be detected by reading the value of the rxd pin. [2] scif status check and receive data read: read scfsr and check that rdf = 1, then read the receive data in scfrdr, read 1 from the rdf flag, and then clear the rdf flag to 0. the transition of the rdf flag from 0 to 1 can also be identified by an rxi interrupt. [3] serial reception continuation procedure: to continue serial reception, read at least the receive trigger set number of receive data bytes from scfrdr, read 1 from the rdf flag, then clear the rdf flag to 0. the number of receive data bytes in scfrdr can be ascertained by reading from scrfdr. [1] [2] [3] figure 19.7 sample flowchar t for receiving serial data
section 19 serial communication interface with fifo (scif) rev. 4.00 sep. 14, 2005 page 731 of 982 rej09b0023-0400 error handling receive error handling er = 1? brk = 1? break handling dr = 1? read receive data in scfrdr clear dr, er, brk flags in scfsr, and orer flag in sclsr, to 0 end yes yes yes no overrun error handling orer = 1? yes no no no [1] whether a framing error or parity error has occurred in the receive data that is to be read from scfrdr can be ascertained from the fer and per bits in scfsr. [2] when a break signal is received, receive data is not transferred to scfrdr while the brk flag is set. however, note that the last data in scfrdr is h'00, and the break data in which a framing error occurred is stored. figure 19.8 sample flowchart fo r receiving serial data (cont)
section 19 serial communication interface with fifo (scif) rev. 4.00 sep. 14, 2005 page 732 of 982 rej09b0023-0400 in serial reception, the scif operates as described below. 1. the scif monitors the transmission line, and if a 0 start bit is detected, performs internal synchronization and starts reception. 2. the received data is stored in scrsr in lsb-to-msb order. 3. the parity bit and stop bit are received. after receiving these bits, the scif carries out the following checks. a. stop bit check: the scif checks whether the stop bit is 1. if there are two stop bits, only the first is checked. b. the scif checks whether receive data can be transferred from the receive shift register (scrsr) to scfrdr. c. overrun check: the scif checks that the orer flag is 0, indicating that the overrun error has not occurred. d. break check: the scif checks that the brk fl ag is 0, indicating that the break state is not set. if all the above checks are passed, the receive data is stored in scfrdr. note: when a parity error or a framing error occurs, reception is not suspended. 4. if the rie bit in scscr is set to 1 when th e rdf or dr flag change s to 1, a receive-fifo- data-full interrupt (rxi) request is generated. if the rie bit or the reie bit in scscr is set to 1 when the er flag changes to 1, a receive-error interrupt (eri) request is generated. if the rie bit or the reie bit in scscr is set to 1 when the brk or orer flag changes to 1, a break reception interrupt (br i) request is generated. figure 19.9 shows an example of the operation for reception.
section 19 serial communication interface with fifo (scif) rev. 4.00 sep. 14, 2005 page 733 of 982 rej09b0023-0400 1 0 d0 d1 d7 0/1 1 0 d0 d1 d7 0/1 0/1 0 rdf fer serial data start bit data parity bit stop bit start bit data parity bit stop bit rxi interrupt request one frame data read and rdf flag read as 1 then cleared to 0 by rxi interrupt handler eri interrupt request generated by receive error figure 19.9 example of scif receive op eration (8-bit data, parity, one stop bit) 5. when modem control is enabled, the rts signal is output depending on the empty status of scfrdr. when rts is 0, reception is possible. when rts is 1, this indicates that scfrdr exceeds the number set for the rts output active trigger. figure 19.10 shows an example of the operation when modem control is used. d0 d1 d2 d7 0/1 d0 d1 d7 0/1 10 0 rts serial data rxd start bit parity bit stop bit start bit figure 19.10 example of op eration using modem control ( rts ) 19.4.3 synchronous operation in synchronous mode, the scif transmits and recei ves data in synchronization with clock pulses. this mode is suitable for high-speed serial communication. the scif transmitter and receiver are independent, so full-duplex communication is possible while sharing the same clock. the transmitter and receiver are also 16-byte fifo buffered, so continuous transmitting or receiving is possible by reading or writing data while transmitting or receiving is in progress.
section 19 serial communication interface with fifo (scif) rev. 4.00 sep. 14, 2005 page 734 of 982 rej09b0023-0400 figure 19.11 shows the general format in synchronous serial communication. don't care don?t care one unit of transfer data (character or frame) bit 0 serial data synchronization clock bit 1 bit 3 bit 4 bit 5 lsb msb bit 2 bit 6 bit 7 * * note: * high except in continuous transfer figure 19.11 data format in synchronous communication in synchronous serial communica tion, each data bit is output on the communication line from one falling edge of the serial clock to the next. data is guaranteed valid at the rising edge of the serial clock. in each character, the serial data bits ar e transmitted in order from the lsb (first) to the msb (last). after output of the msb, the communication line remain s in the state of the msb. in synchronous mode, the scif transmits or receives data by synchronizing with the rising edge of the serial clock. transmit/receive formats: the data length is fixed at eight bits. no parity bit can be added. clock: an internal clock generated by the on-chip baud rate generator or an external clock input from the sck pin can be selected as the scif transmit/receive clock. when the scif operates on an internal clock, it outputs the clock signal at the sck pin. eight clock pulses are output per transmitted or received character. when the scif is not transmitting or receiving, the clock signal remains in the high st ate. when only receiving, the clock signal outputs while the re bit of scscr is 1 an d the number of data in receive fifo is less than the receive fifo data trigger number. transmitting and receiving data: ? scif initialization (synchronous mode) before transmitting, receiving, or changing the mode or communication format, the software must clear the te and re bits to 0 in the serial control register (scscr), then initialize the scif. clearing te to 0 initializes the transmit shift regist er (sctsr). clearing re to 0, however, does not initialize the rdf, per, fer, and orer flag s and receive data regi ster (scrdr), which retain their previous contents.
section 19 serial communication interface with fifo (scif) rev. 4.00 sep. 14, 2005 page 735 of 982 rej09b0023-0400 figure 19.12 shows a sample flowchart for initializing the scif. start of initialization clear te and re bits in scscr to 0 set tfrst and rfrst bits in scfcr to 1 to clear the fifo buffer after reading brk, dr, and er flags in scfsr, write 0 to clear them set cke1 and cke0 bits in scscr (leaving te, re, tie, and rie bits cleared to 0) set data transfer format in scsmr set value in scbrr 1-bit interval elapsed? set rtrg1-0 and ttrg1-0 bits in scfcr, and clear tfrst and rfrst bits to 0 set te and re bits in scscr to 1, and set tie, rie, and reie bits end of initialization wait no yes leave the te and re bits cleared to 0 until the initialization almost ends. be sure to clear the tie, rie, te, and re bits to 0. set the data transfer format in scsmr. set the cke1 and cke0 bits. write a value corresponding to the bit rate into scbrr. this is not necessary if an external clock is used. wait at least one bit interval after this write before moving to the next step. set the te or re bit in scscr to 1. also set the tei, rie, and reie bits to enable the txd, rxd, and sck pins to be used. when transmitting, the txd pin will go to the mark state. when receiving in clocked synchronous mode with the synchronization clock output (clock master) selected, a clock starts to be output from the scif_clk pin at this point. [1] [1] [2] [3] [4] [5] [2] [3] [4] [5] figure 19.12 sample flowch art for scif initialization
section 19 serial communication interface with fifo (scif) rev. 4.00 sep. 14, 2005 page 736 of 982 rej09b0023-0400 ? transmitting serial data (synchronous mode) figure 19.13 shows a sample flowchart for transmitting serial data. use the following procedure for serial data transmission after enabling the scif for transmission. start of transmission read tdfe flag in scfsr tdfe = 1? write transmit data to scftdr and clear tdfe flag in scfsr to 0 all data transmitted? read tend flag in scfsr tend = 1? clear te bit in scscr to 0 end of transmission no yes no yes no yes [1] scif status check and transmit data write: read scfsr and check that the tdfe flag is set to 1, then write transmit data to scftdr, and clear the tdfe flag to 0. the transition of the tdfe flag from 0 to 1 can also be identified by a txi interrupt. [2] serial transmission continuation procedeure: to continue serial transmission, read 1 from the tdfe flag to confirm that writing is possible, them write data to scftdr, and then clear the tdfe flag to 0. [1] [2] figure 19.13 sample flowchart for transmitting serial data
section 19 serial communication interface with fifo (scif) rev. 4.00 sep. 14, 2005 page 737 of 982 rej09b0023-0400 in serial transmission, the scif operates as described below. 1. when data is written into the transmit fifo data register (scftdr), the scif transfers the data from scftdr to the transmit shift register (sctsr) and starts transmitting. confirm that the tdfe flag in the serial status register (scfsr) is set to 1 before writing transmit data to scftdr. the number of data bytes that can be written is (16 ? transmit trigger setting). 2. when data is transferred from scftdr to sctsr and transmission is started, consecutive transmit operations are performed until there is no transmit data left in scftdr. when the number of transmit data bytes in scftdr falls below the transmit trigger number set in the fifo control register (scfcr), the tdfe flag is set. if the tie bit in the serial control register (scsr) is set to 1 at this time, a tr ansmit-fifo-data-empty interrupt (txi) request is generated. if clock output mode is selected, the scif outputs eight synchronous clock pulses. if an external clock source is selected, the scif ou tputs data in synchronization with the input clock. data is output from the txd pin in order from the lsb (bit 0) to the msb (bit 7). 3. the scif checks the scftdr transmit data at the timing for sending the msb (bit 7). if data is present, the data is transf erred from scftdr to sctsr, the msb (bit 7) is sent, and then serial transmission of the next frame is started. if there is no transmit data, the tend flag in scfsr is set to 1, the msb (bit 7) is sent, and then the txd pin holds the states. 4. after the end of serial transmission, the sck pin is held in the high state. figure 19.14 shows an example of scif transmit operation. synchronization clock serial data tdfe tend data written to scftdr and tdfe flag cleared to 0 by txi interrupt handler one frame bit 0 lsb txi interrupt request msb bit 1 bit 6 bit 7 bit 7 bit 0 bit 1 txi interrupt request figure 19.14 example of scif transmit operation
section 19 serial communication interface with fifo (scif) rev. 4.00 sep. 14, 2005 page 738 of 982 rej09b0023-0400 ? receiving serial data (synchronous mode) figure 19.15 shows a sa mple flowchart for receiving seri al data. when switching from asynchronous mode to synchronous mode without scif initialization, make sure that orer, per, and fer are cleared to 0. start of reception read orer flag in sclsr orer = 1? read rdf flag in scfsr rdf = 1? read receive data in scfrdr, and clear rdf flag in scfsr to 0 all data received? clear re bit in scscr to 0 end of reception yes no yes yes no no error handling [1] receive error handling: read the orer flag in sclsr to identify any error, perform the appropriate error handling, then clear the orer flag to 0. reception cannot be resumed while the orer flag is set to 1. [2] scif status check and receive data read: read scfsr and check that rdf = 1, then read the receive data in scfrdr, and clear the rdf flag to 0. the transition of the rdf flag from 0 to 1 can also be identified by an rxi interrupt. [3] serial reception continuation procedure: to continue serial reception, read at least the receive trigger set number of receive data bytes from scfrdr, read 1 from the rdf flag, then clear the rdf flag to 0. the number of receive data bytes in scfrdr can be ascertained by reading scfrdr. however rdf bits is cleared to 0 automatically when the data in scfrdr is read out by the dmac. [1] [2] [3] figure 19.15 sample flowchart for receiving serial data (1)
section 19 serial communication interface with fifo (scif) rev. 4.00 sep. 14, 2005 page 739 of 982 rej09b0023-0400 error handling clear orer flag in sclsr to 0 end overrun error handling orer = 1? yes no figure 19.16 sample flowchart for receiving serial data (2)
section 19 serial communication interface with fifo (scif) rev. 4.00 sep. 14, 2005 page 740 of 982 rej09b0023-0400 in serial reception, the scif operates as described below. 1. the scif synchronizes with serial clock input or output and starts the reception. 2. receive data is shifted into scrsr in order from the lsb to the msb. after receiving the data, the scif checks the receive data can be load ed from scrsr into scfrdr or not. if this check is passed, the scif stores the received data in scfrdr. if the check is not passed (overrun error is detected), further reception is prevented. 3. after setting rdf to 1, if th e receive-data-full interrupt enable bit (rie) is set to 1 in scscr, the scif requests a receive-dat a-full interrupt (rxi). if the orer bit is set to 1 and the receive-data-full interrupt enable bit (rie) or the receive error in terrupt enable bit (reie) in scscr is also set to 1, the scif requests a break interrupt (bri). figure 19.17 shows an example of scif receive operation. synchronization clock serial data rdf orer data read from scfrdr and rdf flag cleared to 0 by rxi interrupt handler one frame bit 7 lsb rxi interrupt request msb bit 0 bit 6 bit 7 bit 7 bit 0 bit 1 bri interrupt request by overrun error rxi interrupt request figure 19.17 example of scif receive operation
section 19 serial communication interface with fifo (scif) rev. 4.00 sep. 14, 2005 page 741 of 982 rej09b0023-0400 ? transmitting and receiving serial data simultaneously (synchronous mode) figure 19.18 shows a samp le flowchart for transm itting and receiving serial data simultaneously. use the following procedure for the simultaneous transmission/r eception of serial data, after enabling the scif for tr ansmission/reception. start of transmission and reception initialization read tdfe flag in scfsr tdfe = 1? write transmit data to scftdr, and clear tdfe flag in scfsr to 0 read orer flag in sclsr orer = 1? read rdf flag in scfsr rdf = 1? clear te and re bits in scscr to 0 end of transmission and reception read receive data in scfrdr, and clear rdf flag in scfsr to 0 all data received? no no yes no no yes yes [1] scif status check and transmit data write: read scfsr and check that the tdfe flag is set to 1, then write transmit data to scftdr, and clear the tdfe flag to 0. the transition of the tdfe flag from 0 to 1 can also be identified by a txi interrupt. [2] receive error handling: read the orer flag in sclsr to identify any error, perform the appropriate error handling, then clear the orer flag to 0. reception cannot be resumed while the orer flag is set to 1. [3] scif status check and receive data read: read scfsr and check that rdf = 1, then read the receive data in scfrdr, and clear the rdf flag to 0. the transition of the rdf flag from 0 to 1 can also be identified by an rxi interrupt. [4] serial transmission and reception continuation procedure: to continue serial transmission and reception, read 1 from the rdf flag and the receive data in scfrdr, and clear the rdf flag to 0 before receiving the msb in the current frame. similarly, read 1 from the tdfe flag to confirm that writing is possible before transmitting the msb in the current frame. then write data to scftdr and clear the tdfe flag to 0. [1] yes error handling [4] when switching from a transmit operation or receive operation to simultaneous transmission and reception operations, clear the te and re bits to 0, and then set them simultaneously to 1. note: [3] [2] figure 19.18 sample flowchart for transmitting/receiving serial data
section 19 serial communication interface with fifo (scif) rev. 4.00 sep. 14, 2005 page 742 of 982 rej09b0023-0400 19.5 scif interrupts and dmac the scif has four interrupt sources: transmit-fifo-data-empty (txi), receive-error (eri), receive-data-full (rxi), and break (bri). table 19.11 shows the interrupt sources and their order of priority. the interrupt sources are enabled or disabled by means of the tie, rie, and reie bits in scscr. a separate interrupt request is sent to the interrupt contro ller for each of these interrupt sources. when txi request is enabled by tie bit and the tdfe flag in the serial stat us register (scfsr) is set to 1, a txi interrupt request and transm it fifo data empty dma transfer request are generated. when txi request is disabled by tie bit and the tdfe flag is set to 1, transmit fifo data empty dma transfer request is generated. the dmac can be activated and data transfer performed by the transmit fifo data empty dma transfer request. when rxi request is enabled by rie bit and the rdf or dr flag in scfsr is set to 1, an rxi interrupt request and receive fifo data full dm a transfer request are generated. when rxi request is disabled by rie bit and the rdf or dr flag in scfsr is set to 1, receive fifo data full dma transfer request is generated. the dmac can be activated and data transfer performed by the receive fifo data full dma transfer request. the rxi interrup t request or receive fifo data full dma transfer request caused by dr flag is generated only in asynchronous mode. when the brk flag in scfsr or the orer flag in sclsr is set to 1, a bri interrupt request is generated. when the er flag in scfsr is set to 1, an eri interrupt request is generated. when transmitting or receiving da ta are transferred by dmac, dm ac should be set enable at first, and then scif should be set enable. scif should be set not to request rxi or txi interrupt to intc. if scif is set to request the interr upt, dma transfer clear s the request to intc independently of interrupt handling program. when the rie bit is set to 0 and the reie bit is set to 1, scif request eri interrupt and bri interrupt without requesting rxi interrupt. the txi interrupt indicates that transmit data can be written, and the rxi interrupt indicates that there is receive data in scfrdr.
section 19 serial communication interface with fifo (scif) rev. 4.00 sep. 14, 2005 page 743 of 982 rej09b0023-0400 table 19.11 scif interrupt sources interrupt source description dmac activation priority on reset release eri interrupt initiated by receive error (er) not possible high rxi interrupt initiated by rece ive data fifo full (rdf) or data ready (dr) * possible bri interrupt initiated by break (brk) or overrun error (orer) not possible txi interrupt initiated by transmit fifo data empty (tdfe) possible low note: * rxi interrupt by dr is only possible in the asynchronous mode. 19.6 usage notes note the following when using the scif. 1. scftdr writing and tdfe flag the tdfe flag in the serial status register (s cfsr) is set when the nu mber of transmit data bytes written in the transmit fifo data regist er (scftdr) has fallen below the transmit trigger number set by bits ttrg1 and ttrg0 in the fifo control register (scfcr). after tdfe is set, transmit data up to the number of empty bytes in scftdr can be written, allowing efficient con tinuous transmission. however, if the number of data bytes written in scftdr is equal to or less than the transmit trigger number, the tdfe flag will be set to 1 again after being read as 1 and cleared to 0. tdfe clearing should therefore be carried out when scftdr contains more than the transmit trigger number of transmit data bytes. the number of tran smit data bytes in scftdr can be found from the upper 8 bits of the fifo data count register (scfdr). 2. scfrdr reading and rdf flag the rdf flag in the serial status register (scfsr) is set when th e number of receive data bytes in the receive fifo data register (scfrdr) ha s become equal to or greater than the receive trigger number set by bits rtrg1 and rtrg0 in the fifo control register (scfcr). after rdf is set, receive data equivalent to the trig ger number can be read from scfrdr, allowing efficient continuo us reception. however, if the number of data bytes in scfrdr is equal to or greater than the trigger number, the rdf flag will be set to 1 again if it is cleared to 0. rdf should therefore be cleared to 0 after being read as 1 after all the receive data has been read.
section 19 serial communication interface with fifo (scif) rev. 4.00 sep. 14, 2005 page 744 of 982 rej09b0023-0400 the number of receive data bytes in scfrdr can be found from the lowe r 8 bits of the fifo data count register (scfdr). 3. break detection and processing break signals can be detected by reading the rxd pin directly when a framing error (fer) is detected. in the break state the input from the rx d pin consists of all 0s, so the fer flag is set and the parity error flag (per) may also be set. note that, althou gh transfer of receive data to scfrdr is halted in the break state, th e scif receiver continues to operate. 4. sending a break signal the i/o condition and level of the txd pin are determined by the spb2io and spb2dt bits in the serial port register (scsptr). this feature can be used to send a break signal. until te bit is set to 1 (enabling transmission) after initializing, txd pin does not work. during the period, mark status is performed by spb2dt bit. therefore, the spb2io and spb2dt bits should be set to 1 (high level output). to send a break signal during serial transmissi on, clear the spb2dt bit to 0 (designating low level), then clear the te bit to 0 (halting transmission). when the te bit is cleared to 0, the transmitter is initialized regardless of the current transmission state, and 0 is output from the txd pin. 5. receive data sampling timing and receive marg in (asynchronous mode) the scif operates on a base clock with a frequency of 16 times the transfer rate. in reception, the scif synchronizes internally with the fall of the start bit, which it samples on the base clock. receive data is latched at the rising edge of the eighth ba se clock pulse. the timing is shown in figure 19.19.
section 19 serial communication interface with fifo (scif) rev. 4.00 sep. 14, 2005 page 745 of 982 rej09b0023-0400 0 1 2 3 4 5 6 7 8 9 10 1112 1314 15 0 1 2 3 4 5 6 7 8 9 10 1112 1314 15 0 1 2 3 4 5 d0 d1 16 clocks 8 clocks base clock receive data (rxd) start bit ?7.5 clocks +7.5 clocks synchronization sampling timing data sampling timing figure 19.19 receive data sampling timing in asynchronous mode the receive margin in asynchron ous mode can therefore be expres sed as shown in equation 1. equation 1: m = (0.5 - ) = (l - 0.5) f - (1+f) 100 % 1 2n d - 0.5 n where: m: receive margin (%) n: ratio of clock frequency to bit rate (n = 16) d: clock duty cycle (d = 0 to 1.0) l: frame length (l = 9 to 12) f: absolute deviation of clock frequency from equation 1, if f = 0 and d = 0.5, the receive margin is 46.875%, as given by equation 2. equation 2: when d = 0.5 and f = 0: m = (0.5 ? 1/(2 16)) 100 % = 46.875 % this is a theoretical value. a reasonable marg in to allow in system designs is 20% to 30%.
section 19 serial communication interface with fifo (scif) rev. 4.00 sep. 14, 2005 page 746 of 982 rej09b0023-0400 6. when using the dmac ? using an external clock in chock synchronous mode: when using an external clock as the synchronization clock, after scftdr is updated by the dmac, an external clock should be input after at least five peripheral clock cycles. a malfunction may occur when the transfer clock is input within four cycles after updating scftdr (figure 19.20). sck tdre txd d0 d1 d2 d6 d7 d3 d4 d5 t note: when the scif is operated on an external clock, set t > 4. figure 19.20 dma transfer example in the synchronization clock ? dma transfer request: when a dma transfer is requested from the scif of which transfer request is allowed by the dmac, the transfer request from the scif is held in the dmac. this transfer request is cleared after it is actually transferred. even if the dme bit of the dma operation register (dmaor) and the de bit of the dma channel control register (chcr) are cleared, the dma transfer request from the scif is retained. in this state, note that the dma transfer is done for one time without any dma transfer request from the scif when the dmac allows the transfer request from the scif. ? tend flag: when the transmit fifo data empty dma transf er request is generated and the transmit data is written to scftdr by the dmac, the value indicated by the tend flag is undefined. thus, do not use the tend flag as a transmit end flag.
section 20 usb function module rev. 4.00 sep. 14, 2005 page 747 of 982 rej09b0023-0400 section 20 usb function module 20.1 features ? incorporates udc (usb device controller) conforming to the usb standard automatic processing of usb protocol automatic processing of usb standard commands for endpoint 0 (some commands and class/vendor commands require decoding and processing by firmware) ? transfer speed : full-speed ? endpoint configuration endpoint name abbreviation transfer type maximum packet size fifo buffer capacity (byte) dma transfer endpoint 0 ep0s setup 8 8 ? ep0i control in 8 8 ? ep0o control out 8 8 ? endpoint 1 ep1 bulk out 64 128 possible endpoint 2 ep2 bulk in 64 128 possible endpoint 3 ep3 interrupt 8 8 ? endpoint 1 endpoint 2 endpoint 3 configuration 1 interface 0 alternate setting 0 ? interrupt requests: generates various interrupt signals necessary for usb transmission/reception ? clock: external input (48 mhz) ? power-down mode power consumption can be reduced by stopping udc internal clock when usb cable is disconnected automatic transition to/rec overy from suspend state ? in on-chip transceiver bypass mode (the xveroff bit of usbxvercr resister is 1), a philips pdiusbp11 series trans ceiver or compatible product can be connected (when using a compatible product, carry out ev aluation and investigation with the manufacturer supplying the transceiver beforehand)
section 20 usb function module rev. 4.00 sep. 14, 2005 page 748 of 982 rej09b0023-0400 ? power mode: self-powered, bus-powered 20.1.1 block diagram status and control registers internal peripheral bus udc: usb device controller fifo (288 bytes) interrupt requests dma transfer requests clock (48 mhz) udc usb function module to transceiver figure 20.1 block diagram of usb 20.2 pin configuration table 20.1 pin configuration and functions pin name i/o function xveroff conditions xvdata input input pin for receive data from differential receiver 1 dpls input input pin to driver for d+ signal from receiver 1 dmns input input pin to driver for d? signal from receiver 1 txdpls output d+ transmit output pin to driver 1 txdmns output d? transmit output pin to driver 1 txenl output driver output enable pin 1 vbus input usb cable connection monitor pin 1/0 suspnd output transceiver suspend state output pin 1/0 uclk input usb clock input pin (48 mhz input) 1/0 dp i/o on-chip transceiver d + signal 0 dm i/o on-chip transceiver d - signal 0
section 20 usb function module rev. 4.00 sep. 14, 2005 page 749 of 982 rej09b0023-0400 in on-chip transceiver bypass mode (the xveroff bit of the usbxvercr register is 1), a philips pdiusbp11 series transceiver or compatible product can be connected (when using a compatible product, carry out evaluation and investigation with the manufacturer supplying the transceiver beforehand). 20.3 register descriptions the usb has the following registers. ? usb interrupt flag register 0 (usbifr0) ? usb interrupt flag register 1 (usbifr1) ? usb interrupt flag register 2 (usbifr2) ? usb interrupt select register 0 (usbisr0) ? usb interrupt select register 1 (usbisr1) ? usb interrupt enable register 0 (usbier0) ? usb interrupt enable register 1 (usbier1) ? usb interrupt enable register 2 (usbier2) ? usbep0i data register (usbepdr0i) ? usbep0o data register (usbepdr0o) ? usbep0s data register (usbepdr0s) ? usbep1 data register (usbepdr1) ? usbep2 data register (usbepdr2) ? usbep3 data register (usbepdr3) ? usbep0o receive data size register (usbepsz0o) ? usbep1 receive data size register (usbepsz1) ? usb trigger register (usbtrg) ? usb data status register (usbdasts) ? usb fifo clear register (usbfclr) ? usb dma transfer setting register (usbdmar) ? usb endpoint stall register (usbepstl) ? usb transceiver control register (usbxvercr) ? usb bus power control register (usbctrl)
section 20 usb function module rev. 4.00 sep. 14, 2005 page 750 of 982 rej09b0023-0400 20.3.1 usb interrupt flag register 0 (usbifr0) together with usb interrupt flag registers 1 (usbifr1) and 2 (usbifr2), usbifr0 indicates interrupt status information required by the application. when an interrupt occurs, the corresponding bit is set to 1 and an interrupt request is sent to the cpu according to the combination with usb interrupt enable register 0 (usbier0). clearing is performed by writing 0 to the bit to be cleared, and 1 to the other bits. however, ep1 full and ep2 empty are status bits, and cannot be cleared. usbifr0 is initialized to h ' 10 by a power-on reset. bit bit name initial value r/w description 7 brst 0 r/w bus reset set to 1 when the bus reset signal is detected on the usb bus. 6 ep1full 0 r ep1 fifo full this bit is set when endpoint 1 receives one packet of data normally from the host, and holds a value of 1 as long as there is valid data in the fifo buffer. ep1 full is a status bit, and cannot be cleared. 5 ep2tr 0 r/w ep2 transfer request this bit is set if there is no valid transmit data in the fifo buffer when an in token for endpoint 2 is received from the host. a nack handshake is returned to the host until data is written to the fifo buffer and packet transmission is enabled. 4 ep2empty 1 r ep2 fifo empty this bit is set when at least one of the dual endpoint 2 transmit fifo buffers is ready for transmit data to be written. ep2 empty is a status bit, and cannot be cleared. 3 setupts 0 r/w setup command receive complete this bit is set to 1 when endpoint 0 receives normally a setup command requiring decoding on the application side, and returns an ack handshake to the host.
section 20 usb function module rev. 4.00 sep. 14, 2005 page 751 of 982 rej09b0023-0400 bit bit name initial value r/w description 2 ep0ots 0 r/w ep0o receive complete this bit is set to 1 when endpoint 0 receives data from the host normally, stores the data in the fifo buffer, and returns an ack handshake to the host. 1 ep0itr 0 r/w ep0i transfer request this bit is set if there is no valid transmit data in the fifo buffer when an in token for endpoint 0 is received from the host. a nack handshake is returned to the host until data is written to the fifo buffer and packet transmission is enabled. 0 ep0its 0 r/w ep0i transmit complete this bit is set when data is transmitted to the host from endpoint 0 and an ack handshake is returned. 20.3.2 usb interrupt flag register 1 (usbifr1) together with usb interrupt flag registers 0 (usbifr0) and 2 (usbifr2), usbifr1 indicates interrupt status information required by the application. when an interrupt occurs, the corresponding bit is set to 1 and an interrupt request is sent to the cpu according to the combination with usb interrupt enable register 1 (usbier1). clearing is performed by writing 0 to the bit to be cleared, and 1 to the other bits. however, vbusmn is a status bit, and cannot be cleared. usbifr1 is initialized to h ' 20 by a power-on reset. bit bit name initial value r/w description 7 to 4 ? all 0 r reserved the write value should always be 0. 3 vbusmn 0 r status bit for monito ring the status of the vbus pin. the status of the vbu s pin is reflected. 0: disconnected 1: connected
section 20 usb function module rev. 4.00 sep. 14, 2005 page 752 of 982 rej09b0023-0400 bit bit name initial value r/w description 2 ep3tr 0 r/w ep3 transfer request this bit is set if there is no valid transmit data in the fifo buffer when an in token for endpoint 3 is received from the host. a nack handshake is returned to the host until data is written to the fifo buffer and packet transmission is enabled. 1 ep3ts 0 r/w ep3 transmit complete this bit is set when data is transmitted to the host from endpoint 3 and an ack handshake is returned. 0 vbus 0 r/w ubs disconnection detection this bit is set to 1 when a function is connected to or disconnected from the usb bus. use the vbuscnt pin of this module to detect connection/disconnection. 20.3.3 usb interrupt flag register 2 (usbifr2) together with usb interrupt flag registers 0 (usbifr0) and 1 (usbifr1), usbifr2 indicates interrupt status information required by the application. when an interrupt occurs, the corresponding bit is set to 1 and an interrupt request is sent to the cpu according to the combination with usb interrupt enable register 2 (usbier2). clearing is performed by writing 0 to the bit to be cleared, and 1 to the other bits. however, cfgv is a status bit, and cannot be cleared. usbifr2 is initialized to h ' 20 by a power-on reset. bit bit name initial value r/w description 7 6 5 4 ? ? ? ? 0 0 1 0 r r r r reserved the write value should always be 0. 3 awake 0 r/w awake signal detection this bit is set to 1 when t he resume or bus reset signal is detected on the usb bus in the suspend state with usbctrl/suspend = 1. 2 susps 0 r/w usb suspend signal detection this bit is set to 1 when the usb suspend signal is detected with usbctrl/suspend = 1.
section 20 usb function module rev. 4.00 sep. 14, 2005 page 753 of 982 rej09b0023-0400 bit bit name initial value r/w description 1 cfgv 0 r configuration value status bit for monitoring the c onfiguration value. this is a status bit and cannot be cleared. 0 setc 0 r/w set_configuration request detection this bit is set to 1 wh en the set_configuration request is received. 20.3.4 usb interrupt sel ect register 0 (usbisr0) usbisr0 selects the vector number s of the interrupt requests i ndicated in usb interrupt flag register 0 (usbifr0). if the usb issues an interrupt request to the intc when the corresponding bit in usbisr0 is cleared to 0, the interrupt will be usi0 (usb interrupt 0). if the usb issues an interrupt request to the intc when the corresponding bit in usbisr0 is set to 1, the interrupt will be usi1 (usb interrupt 1). if interrupts occur simultaneously, usi0 has priority by default. usbisr0 is initialized to h ' 00 by a power-on reset. bit bit name initial value r/w description 7 brst 0 r/w bus reset 6 ep1full 0 r/w ep1fifo full 5 ep2tr 0 r/w ep2 transfer request 4 ep2empty 0 r/w ep2 fifo empty 3 setupts 0 r/w setup command receive completion 2 ep0ots 0 r/w epoo receive completion 1 ep0itr 0 r/w epoi transfer request 0 ep0its 0 r/w epoi transmit completion
section 20 usb function module rev. 4.00 sep. 14, 2005 page 754 of 982 rej09b0023-0400 20.3.5 usb interrupt sel ect register 1 (usbisr1) usbisr1 selects the vector number s of the interrupt requests i ndicated in usb interrupt flag register 1 (usbifr1). if the usb issues an interrupt request to the intc when the corresponding bit in usbisr1 is cleared to 0, the interrupt will be usi0 (usb interrupt 0). if the usb issues an interrupt request to the intc when the corresponding bit in usbisr1 is set to 1, the interrupt will be usi1 (usb interrupt 1). if interrupts occur simultaneously, usi0 has priority by default. usbisr1 is initialized to h ' 07 by a power-on reset. bit bit name initial value r/w description 7 to 3 ? all 0 r reserved the write value should always be 0. 2 ep3tr 0 r/w ep3 transfer request 1 ep3ts 0 r/w ep3 transmission completion 0 vbusf 0 r/w usb bus connection 20.3.6 usb interrupt enable register 0 (usbier0) usbier0 enables the interrupt requests indicated in usb interrupt flag register 0 (usbifr0). when an interrupt flag is set while the corresponding bit in usbier0 is set to 1, an interrupt request is sent to the cpu. the interrupt vector number is decided by the contents of usb interrupt select register 0 (usbisr0). usbier0 is initialized to h ' 00 by a power-on reset. bit bit name initial value r/w description 7 brst 0 r/w bus reset 6 ep1full 0 r/w ep1fifo full 5 ep2tr 0 r/w ep2 transfer request 4 ep2empty 0 r/w ep2 fifo empty 3 setupts 0 r/w setup command receive completion 2 ep0ots 0 r/w epoo receive completion 1 ep0itr 0 r/w epoi transfer request 0 ep0its 0 r/w epoi transmit completion
section 20 usb function module rev. 4.00 sep. 14, 2005 page 755 of 982 rej09b0023-0400 20.3.7 usb interrupt enable register 1 (usbier1) usbier1 enables the interrupt requests indicated in usb interrupt flag register 1 (usbifr1). when an interrupt flag is set while the corresponding bit in usbier1 is set to 1, an interrupt request is sent to the cpu. the interrupt vector number is decided by the contents of usb interrupt select register 1 (usbisr1). usbier1 is initialized to h ' 00 by a power-on reset. bit bit name initial value r/w description 7 to 3 ? all 0 r reserved the write value should always be 0. 2 ep3tr 0 r/w ep3 transfer request 1 ep3ts 0 r/w ep3 transmit completion 0 vbus 0 r/w usb bus connection 20.3.8 usb interrupt enable register 2 (usbier2) usbier2 enables the interrupt requests detect ed by set_configuration in usb interrupt flag register 2 (usbifr2). when the usbifr2/s etc flag is set while the corresponding bit in usbier2 is set to 1, a usihp interr upt request is sent to the cpu. usbier2 is initialized to h ' 00 by a power-on reset. bit bit name initial value r/w description 7 to 1 ? all 0 r reserved the write value should always be 0. 0 setc 0 r/w set_configuration request detection
section 20 usb function module rev. 4.00 sep. 14, 2005 page 756 of 982 rej09b0023-0400 20.3.9 usbep0i data register (usbepdr0i) usbepdr0i is an 8-byte transmit fifo buffer for endpoint 0, holding one packet of transmit data for control in. transmit data is fixed by writing one packet of data and setting the ep0ipkte bit in the trigger register. when an ack handshake is returned from the host after the data has been transmitted, bit 0 (ep0its) in usb interrupt flag register 0 is set. usbep0i can be initialized by means of the ep0iclr bit in usbfclr. bit bit name initial value r/w description 7 to 0 d7 to d0 undefined w data register for control in transfer 20.3.10 usbep0o data register (usbepdr0o) usbepdr0o is an 8-byte receive fifo buffer for endpoint 0. usbepdr0o holds endpoint 0 receive data other than setup commands. when da ta is received normally, the ep0ots bit in usb interrupt flag register 0 is set, and the number of receive bytes is indicated in the ep0o receive data size register. after the data has been read, setting the ep0ordfn bit in the trigger register enables the next packet to be received. usbepdr0o can be initialized by means of the ep0oclr bit in usbfclr. bit bit name initial value r/w description 7 to 0 d7 to d0 undefined r data register for control out transfer
section 20 usb function module rev. 4.00 sep. 14, 2005 page 757 of 982 rej09b0023-0400 20.3.11 usbep0s data register (usbepdr0s) usbepdr0s is an 8-byte fifo buffer specifically for endpoint 0 setup command reception and stores an 8-byte command data that is sent in the setup stage. usbepdr0s r eceives only commands requiring processing on the microcomputer (firmware) side. commands that this module automatically processes ar e not stored. when command da ta is received normally, the setupts bit in usb interrupt flag register 0 is set. as a setup command must be received without fail, if data is left in this buffer, it will be overwritten with new data. if recep tion of the next command is started while the current command is being read, command reception has priority and the read data is invalid. bit bit name initial value r/w description 7 to 0 d7 to d0 undefined r register for storing the setup command on control out transfer 20.3.12 usbep1 data register (usbepdr1) usbepdr1 is a 128-byte receive fifo buffer for endpoint 1. usbepdr1 has a dual-buffer configuration, and has a capacity of twice the maximum packet size. when one packet of data is received normally fr om the host, the ep1full bit in usb in terrupt flag register 0 is set. the number of receive bytes is indicat ed in the ep1 receive data size register. after the data has been read, the buffer that was read is enabled to receive again by writing 1 to the ep1rdfn bit in the usb trigger register. the receive data in this fifo buffer can be transferred by dma (dual address transfer byte by byte). usbepdr1 can be initialized by means of the ep1clr bit in usbfclr. bit bit name initial value r/w description 31 to 0 * d31 to d0 undefined r data register for endpoint 1 transfer note: * 7 to 0 bits for dma transfer.
section 20 usb function module rev. 4.00 sep. 14, 2005 page 758 of 982 rej09b0023-0400 20.3.13 usbep2 data register (usbepdr2) usbepdr2 is a 128-byte transmit fifo buffer for endpoint 2. usbepdr2 has a dual-buffer configuration, and has a capacity of twice the maxi mum packet size. when tr ansmit data is written to this fifo buffer and the ep2pkte bit in the usb trigger register is set, one packet of transmit data is fixed, and the dual buffer is switched over. transmit data for this fifo buffer can be transferred by dma (dual address transfer byte by byte). usbepdr2 can be initialized by means of the ep2clr bit in usbfclr. bit bit name initial value r/w description 31 to 0 * d31 to d0 undefined w data register for endpoint 2 transfer note: * 7 to 0 bits for dma transfer. 20.3.14 usbep3 data register (usbepdr3) usbepdr3 is an 8-byte transmit fifo buffer for endpoint 3, holding one packet of transmit data in endpoint 3 interrupt transfer. transmit data is fixed by writing one packet of data and setting the ep3pkte bit in the usb trigger register. when an ack handshake is received from the host after one packet of data has been transmitted normally, the ep3ts bit in the usb interrupt flag register 0 is set. usbepdr3 can be initialized by means of the ep3clr bit in usbfclr. bit bit name initial value r/w description 7 to 0 d7 to d0 undefined w data register for endpoint 3 transfer 20.3.15 usbep0o receive data size register (usbepsz0o) usbepsz0o indicates, in bytes, the amount of data received from the host by endpoint 0o. usbepsz0o can be initialized to h ' 00 by a power-on reset. bit bit name initial value r/w description 7 to 0 ? all 0 r number of bytes received by endpoint 0
section 20 usb function module rev. 4.00 sep. 14, 2005 page 759 of 982 rej09b0023-0400 20.3.16 usbep1 receive data size register (usbepsz1) usbepsz1 indicates, in bytes, the amount of da ta received from the host by endpoint 1. the endpoint 1 fifo buffer has a dual-fifo configura tion. the receive data size indicated by this register refers to the currently select ed fifo (that can be read by cpu). usbepsz1 can be initialized to h ' 00 by a power-on reset. bit bit name initial value r/w description 7 to 0 ? all 0 r number of bytes received by endpoint 1 20.3.17 usb trigger register (usbtrg) usbtrg generates one-shot triggers to control the transmit/receive sequence for each endpoint. usbtrg can be initialized to h ' 00 by a power-on reset. bit bit name initial value r/w description 7 ? 0 r reserved this bit is always read as 0. the write value should always be 0. 6 ep3pkte 0 w ep3 packet enable after one packet of data has been written to the endpoint 3 transmit fifo buf fer, the transmit data is fixed by writing 1 to this bit. 5 ep1rdfn 0 w ep1 read complete write 1 to this bit after one packet of data has been read from the endpoint 1 fifo buffer. the endpoint 1 receive fifo buffer has a dual-fifo configuration. writing 1 to this bit initializes the fifo that was read, enabling the next packet to be received. 4 ep2pkte 0 w ep2 packet enable after one packet of data has been written to the endpoint 2 fifo buffer, the transmit data is fixed by writing 1 to this bit. 3 ? 0 r reserved the write value should always be 0.
section 20 usb function module rev. 4.00 sep. 14, 2005 page 760 of 982 rej09b0023-0400 bit bit name initial value r/w description 2 ep0srdfn 0 w ep0s read complete write 1 to this bit after ep0s command fifo data has been read. writing 1 to this bit enables transmission/reception of data in the following data stage. a nack handshake is returned in response to transmit/receive requests from the host in the data stage until 1 is written to this bit. 1 ep0ordfn 0 w ep0o read complete writing 1 to this bit after one packet of data has been read from the endpoint 0 transmit fifo buffer initializes the fifo buffer, enabling the next packet to be received. 0 ep0ipkte 0 w ep0i packet enable after one packet of data has been written to the endpoint 0 transmit fifo buf fer, the transmit data is fixed by writing 1 to this bit. 20.3.18 usb data status register (usbdasts) usbdasts indicates whether the transmit fifo buffers contain valid data. a bit is set to 1 when data is written to the corresponding fifo buffer and the packet enable state is set. this bit is cleared when all data has been transmitted to the host. in the case of dual-fifo buffer for endpoint 2, this bit is cleared when all data on two fifos has been transmitted to the host. usbdasts can be initialized to h ' 00 by a power-on reset. bit bit name initial value r/w description 7, 6 ? all 0 r reserved the write value should always be 0. 5 ep3de 0 r ep3 data present this bit is set when the endpoint 3 fifo buffer contains valid data.
section 20 usb function module rev. 4.00 sep. 14, 2005 page 761 of 982 rej09b0023-0400 bit bit name initial value r/w description 4 ep2de 0 r ep2 data present this bit is set when the endpoint 2 fifo buffer contains valid data 3 to 1 ? all 0 r reserved the write value should always be 0. 0 ep0ide 0 r ep0i data present this bit is set when the endpoint 0 transmit fifo buffer contains valid data. 20.3.19 usbfifo clear register (usbfclr) usbfclr is provided to initialize the fifo buffers for each endpoint. writing 1 to a bit clears all the data in the corresponding fifo buffer. the corresponding interr upt flag is not cleared. do not clear a fifo buffer during transmission/reception. usbfclr can be initialized to h ' 00 by a power-on reset. bit bit name initial value r/w description 7 ? 0 ? reserved the write value should always be 0. 6 ep3clr 0 w ep3 clear when 1 is written to this bit, the endpoint 3 transmit fifo buffer is initialized. 5 ep1clr 0 w ep1 clear when 1 is written to this bit, both fifos in the endpoint 1 receive fifo buffer are initialized. 4 ep2clr 0 w ep2 clear when 1 is written to this bit, both fifos in the endpoint 2 transmit fifo buffer are initialized. 3, 2 ? all 0 ? reserved the write value should always be 0. 1 ep0oclr 0 w ep0o clear when 1 is written to this bit, the endpoint 0 receive fifo buffer is initialized.
section 20 usb function module rev. 4.00 sep. 14, 2005 page 762 of 982 rej09b0023-0400 bit bit name initial value r/w description 0 ep0iclr 0 w ep0i clear when 1 is written to this bit, the endpoint 0 transmit fifo buffer is initialized. 20.3.20 usbdma transfer setting register (usbdmar) usbdmar enables dma transfer between the endpoint 1 and endpoint 2 data registers and memory by means of the on-chip dma controller (dmac). dual address transfer is performed with the transfer size of only on a per-byte basi s. in order to start dma transfer, dmac settings must be made in addition to the settings in th is register. for details of dma transfer, see section 20.7, dma transfer. usbdmar can be initialized to h ' 00 by a power-on reset. bit bit name initial value r/w description 7 to 2 ? all 0 r reserved the write value should always be 0. 1 ep2dmae 0 r/w endpoint 2 dma transfer enable when this bit is set, dma transfer is enabled from memory to the endpoint 2 transmit fifo buffer. if there is at least one byte of space in the fifo buffer, a transfer request is asserted for the dma controller. in dma transfer, when 64 bytes are written to the fifo buffer, the ep2 packet enable bit is set automatically, allowing 64 bytes of data to be transferred. if there is still space in the other of the two fifos, a transfer request is asserted for the dma controller again. however, if the size of the data packet to be transmitted is less than 64 bytes, the ep2 packet enable bit is not set automatically, and so should be set by the cpu with a dma transfer end interrupt. also, as ep2-related interrupt requests to the cpu are not automatically masked, interrupt requests should be masked as necessary in the interrupt enable register.
section 20 usb function module rev. 4.00 sep. 14, 2005 page 763 of 982 rej09b0023-0400 bit bit name initial value r/w description 0 ep1dmae 0 r/w endpoint 1 dma transfer enable when this bit is set, dma transfer is enabled from the endpoint 1 receive fifo buffer to memory. if there is at least one byte of receive data in the fifo buffer, a transfer request is asserted for the dma controller. in dma transfer, when all the received data is read, ep1 is read automatically and the completion trigger operates. also, as ep1-related interrupt requests to the cpu are not automatically masked, interrupt requests should be masked as necessary in the interrupt enable register. 20.3.21 usb endpoint stall register (usbepstl) the bits in usbepstl are used to forcibly stall the endpoints on the application side. while a bit is set to 1, the corresponding endpoint returns a stall handshake to the host. the stall bit for endpoint 0 (ep0stl) is cleared automatically on reception of 8-bit command data for which decoding is performed in this function module. when the setupts flag in usbifr0 is set, writing 1 to the ep0stl bit is ignored. for details, see section 20.6, stall operations. when asce = 1 is specified, the epxstl bit is automatically cleared. usbepstl can be initialized to h ' 00 by a power-on reset. bit bit name initial value r/w description 7 to 5 ? all 0 r reserved the write value should always be 0. 4 asce 0 r/w auto-stall clear enable when this bit is set to 1, the stall setting bit (usbepstlr/esxstl) of the usb endpoint is automatically cleared after a stall handshake is returned to the host. this bit cannot be set for each endpoint. 3 ep3stl 0 r/w ep3 stall when this bit is set to 1, endpoint 3 is placed in the stall state.
section 20 usb function module rev. 4.00 sep. 14, 2005 page 764 of 982 rej09b0023-0400 bit bit name initial value r/w description 2 ep2stl 0 r/w ep2 stall when this bit is set to 1, endpoint 2 is placed in the stall state. 1 ep1stl 0 r/w ep1 stall when this bit is set to 1, endpoint 1 is placed in the stall state. 0 ep0stl 0 r/w ep0 stall when this bit is set to 1, endpoint 0 is placed in the stall state. 20.3.22 usb transceiver co ntrol register (usbxvercr) the usb transceiver control register (usbxvercr) selects the on-chip transceiver or the external transceiver. make sure to check if usbifr1/vbusmn=0 (vbus pin disconnection) to overwrite this register. usbxvercr can be initialized to h ' 00 by a power-on reset. bit bit name initial value r/w description 7 to 1 ? all 0 r reserved the write value should always be 0. 0 xveroff 0 r/w transceiver control 1: the on-chip transceiver operates. 0: the on-chip transceiver function stops, and digital signals for the external transceiver are output from the port.
section 20 usb function module rev. 4.00 sep. 14, 2005 page 765 of 982 rej09b0023-0400 20.3.23 usb bus power control register (usbctrl) this lsi can operate using a bus power control method. for details of the bus power control method, see section 20.9, usb bus power control method. usbctrl can be initialized to h ' 00 by a power-on reset. bit bit name initial value r/w description 7 to 2 ? all 0 r reserved the write value should always be 0. 1 suspend 0 r/w usb suspend enable allows an interrupt by the usb suspend signal or awake signal detection. 0 pwmd 0 r/w power mode changes how the power is supplied. 0: self-powered 1: bus-powered
section 20 usb function module rev. 4.00 sep. 14, 2005 page 766 of 982 rej09b0023-0400 20.4 operation 20.4.1 cable connection cable disconnected vbus pin = 0 v udc core reset usb cable connection usbifr1/vbus = 1 usb bus connection interrupt udc core reset release bus reset reception usbifr0/brst = 1 bus reset interrupt wait for setup command reception complete interrupt usb function application general output port d+ pull-up enabled? usb module interrupt setting as soon as preparations are completed, enable d+ pull-up in general output port clear vbus flag (usbifr1/vbus) firmware preparations for start of usb communication clear bus reset flag (usbifr0/brst) clear fifos (ep0, ep1, ep2, ep3) yes no initial settings wait for setup command reception complete interrupt interrupt request interrupt request figure 20.2 cable connection operation the flowchart in figure 20.2 sh ows the operation in the case fo r section 20.8, example of usb external circuitry. in applications that do not re quire usb cable connection to be detected, processing by the usb bus connection interrupt is not necessary. preparations should be made with the bus reset interrupt.
section 20 usb function module rev. 4.00 sep. 14, 2005 page 767 of 982 rej09b0023-0400 also, in applications that require connection detection regardless of d+ pull-up control, detection should be carried out using irqx or a general input port. for details, see section 20.8, example of usb external circuitry. 20.4.2 cable disconnection usb function application cable connected vbus pin = 1 usb cable disconnection vbus pin = 0 udc core reset end figure 20.3 cable disconnection operation the flowchart in figure 20.3 sh ows the operation in the case fo r section 20.8, example of usb external circuitry.
section 20 usb function module rev. 4.00 sep. 14, 2005 page 768 of 982 rej09b0023-0400 20.4.3 control transfer control transfer consists of three stages: setup, data (not always included), and status (figure 20.4). the data stage comprises a number of bus transactions. operatio n flowcharts for each stage are shown below. control in setup stage data stage status stage control out no data setup(0) data0 setup(0) data0 setup(0) data0 in(1) data1 out(1) data1 in(0) data0 out(0) . . . . . . data0 in(0/1) data0/1 out(0/1) data0/1 out(1) data1 in(1) data1 in(1) data1 figure 20.4 transfer st ages in control transfer
section 20 usb function module rev. 4.00 sep. 14, 2005 page 769 of 982 rej09b0023-0400 setup stage: usb function application setup token reception receive 8-byte command data in ep0s to data stage set setup command reception complete flag (usbifr0/setup ts = 1) automatic processing by this module clear setup ts flag (usbifr0/setup ts = 0) clear ep0i fifo (ufclr/ep0iclr = 1) clear ep0o fifo (ufclr/ep0oclr = 1) read 8-byte data from ep0s decode command data determine data stage direction* 1 write 1 to ep0s read complete bit (usbtrg/ep0s rdfn = 1) to control-in data stage to control-out data stage command to be processed by application? interrupt request yes no notes: 1. in the setup stage, the application analyzes command data from the host requiring processing by the application, and determines the subsequent processing (for example, data stage direction, etc.). 2. when the transfer direction is control-out, the ep0i transfer request interrupt required in the status stage should be enabled here. when the transfer direction is control-in, this interrupt is not required and should be disabled. * 2 figure 20.5 setup stage operation
section 20 usb function module rev. 4.00 sep. 14, 2005 page 770 of 982 rej09b0023-0400 data stage (control-in): the application first analyzes command data from the host in the setup stage, and determines the subsequent data stage direction. if the resu lt of command data analysis is that the data stage is in-transfer, one packet of data to be sent to the host is written to the fifo. if there is more data to be sent, this data is writte n to the fifo after the data written first has been sent to the host (usbifr0/ep0its = 1). the end of the data stage is identified when the host transmits an out token and the status stage is entered. usb function application in token reception data transmission to host set ep0i transmission complete flag (usbifr0/ep0i ts = 1) from setup stage write data to usbep0i data register (usbepdr0i) write 1 to ep0i packet enable bit (usbtrg/ep0i pkte = 1) clear ep0i transmission complete flag (usbifr0/ep0i ts = 0) write 1 to ep0i packet enable bit (usbtrg/ep0i pkte = 1) write data to usbep0i data register (usbepdr0i) 1 written to usbtrg/ep0s rdfn? valid data in ep0i fifo? nack nack no no yes yes ack interrupt request figure 20.6 data stag e (control-in) operation note: if the size of the data transmitted by the fu nction is smaller than the data size requested by the host, the function indicates the end of the da ta stage by returning to the host a packet shorter than the maximum packet size. if the si ze of the data transmitt ed by the function is an integral multiple of the maximum packet si ze, the function indicates the end of the data stage by transmitting a zero-length packet.
section 20 usb function module rev. 4.00 sep. 14, 2005 page 771 of 982 rej09b0023-0400 data stage (control-out): the application first analyzes comm and data from the host in the setup stage, and determines the subsequent data stage direction. if the result of command data analysis is that the data stage is out-transfer, the application wa its for data from the host, and after data is received (usbifr0/ep0ots = 1), re ads data from the fifo. next, the application writes 1 to the ep0o read comple te bit, empties the receive fifo , and waits for reception of the next data. the end of the data stage is identified when the ho st transmits an in token and the status stage is entered. usb function application out token reception data reception from host out token reception set ep0o reception complete flag (usbifr0/ep0o ts = 1) clear ep0o reception complete flag (usbifr0/ep0o ts = 0) read data from usbep0o receive data size register (usbepsz0o) write 1 to ep0o read complete bit (usbtrg/ep0o rdfn = 1) read data from usbep0o data register (usbepdr0o) 1 written to usbtrg/ep0s rdfn? 1 written to usbtrg/ep0o rdfn? nack nack ack no yes no yes interrupt request figure 20.7 data stag e (control-out) operation
section 20 usb function module rev. 4.00 sep. 14, 2005 page 772 of 982 rej09b0023-0400 status stage (control-in): the control-in status stage starts with an out token from the host. the application receives 0-byte data from the host, and ends control transfer. usb function application out token reception 0-byte reception from host end of control transfer set ep0o reception complete flag (usbifr0/ep0o ts = 1) clear ep0o reception complete flag (usbifr0/ep0o ts = 0) write 1 to ep0o read complete bit (usbtrg/ep0o rdfn = 1) end of control transfer ack interrupt request figure 20.8 status stag e (control-in) operation
section 20 usb function module rev. 4.00 sep. 14, 2005 page 773 of 982 rej09b0023-0400 status stage (control-out): the control-out status stage starts with an in token from the host. when an in token is received at the start of the status stage, there is not yet any data in the ep0ififo, and so an ep0i transfer request interrupt is generated. the application recognizes from this interrupt that the status stage has started. next, in order to transmit 0-byte data to the host, 1 is written to the ep0i packet enable bit but no data is written to the ep0i fifo. as a result, the next in token causes 0-byte data to be transmitte d to the host, and control transfer ends. after the application has finished all processing relating to the data stage, 1 should be written to the ep0i packet enable bit. usb function application in token reception 0-byte transmission to host end of control transfer set ep0i transmission complete flag (usbifr0/ep0i ts = 1) clear ep0i transfer request flag (usbifr0/ep0i tr = 0) write 1 to ep0i packet enable bit (usbtrg/ep0i pkte = 1) clear ep0i transmission complete flag (usbifr0/ep0i ts = 0) end of control transfer valid data in ep0i fifo? ack yes no nack interrupt request interrupt request figure 20.9 status stag e (control-out) operation
section 20 usb function module rev. 4.00 sep. 14, 2005 page 774 of 982 rej09b0023-0400 20.4.4 ep1 bulk-out transfer (dual fifos) ep1 has two 64-byte fifos, but the user can perform data reception and receive data reads without being aware of this dual-fifo configuration. when one fifo is full after recep tion is completed, the usbifr0/ ep1 full bit is set. after the first receive operation into one of the fifos when both fifos are em pty, the other fifo is empty, and so the next packet can be received immediately. when both fifos are fu ll, nack is returned to the host automatically. when r eading of the receive data is completed following data reception, 1 is written to the usbtrg/ep1 rdfn bit. this operation empties the fifo that has just been read, and makes it ready to receive the next packet.
section 20 usb function module rev. 4.00 sep. 14, 2005 page 775 of 982 rej09b0023-0400 usb function application out token reception data reception from host set ep1 fifo full status (usbifr0/ep1 full = 1) clear ep1 fifo full status (usbifr0/ep1 full = 0) read usbep1 receive data size register (usbepsz1) read data from usbep1 data register (usbepdr1) write 1 to ep1 read complete bit (usbtrg/ep1 rdfn = 1) space in ep1 fifo? no yes both ep1 fifos empty? no yes nack ack interrupt request interrupt request figure 20.10 ep1 bulk-out transfer operation
section 20 usb function module rev. 4.00 sep. 14, 2005 page 776 of 982 rej09b0023-0400 20.4.5 ep2 bulk-in transfer (dual fifos) ep2 has two 64-byte fifos, but the user can perform data transmission and transmit data writes without being aware of this dual-fifo configura tion. however, one data write is performed for one fifo. for example, even if both fifos are empty, it is not possible to perform ep2/pkte at one time after consecutively writing 128 bytes of data. ep2/pkte must be performed for each 64- byte write. when performing bulk-in transfer, as there is no valid data in the fifos on reception of the first in token, a usbifr0/ep2 tr interrupt is requested. with this interrupt, 1 is written to the usbier0/ep2empty bit, and the ep2 fifo empty interrupt is enabled. at first, both ep2 fifos are empty, and so an ep2 fifo empty interrupt is generated immediately. the data to be transmitted is written to the data regi ster using this interrupt. after the first transmit data write for one fifo, the other fifo is empty, and so the next transmit data can be written to the other fifo immediately. when both fifos are fu ll, ep2empty is cleared to 0. if at least one fifo is empty, usbifr0/ep2empty is set to 1. when ack is returned from the host after data transmission is completed, the fifo used in the data transmission becomes empty. if the other fifo contains valid transmit data at th is time, transmission can be continued. when transmission of all data has been completed, write 0 to usbier0/ep2empty and disable interrupt requests.
section 20 usb function module rev. 4.00 sep. 14, 2005 page 777 of 982 rej09b0023-0400 usb function application in token reception data transmission to host clear ep2 transfer request flag (usbifr0/ep2 tr = 0) enable ep2 fifo empty interrupt (usbier0/ep2 empty = 1) usbier0/ep2 empty interrupt write one packet of data to usbep2 data register (usbepdr2) write 1 to ep2 packet enable bit (usbtrg/ep2 pkte = 1) set ep2 empty status (usbifr0/ep2 empty = 1) valid data in ep2 fifo? nack ack interrupt request yes no clear ep2 empty status (usbifr0/ep2 empty = 0) space in ep2 fifo? no yes interrupt request figure 20.11 ep2 bulk-in transfer operation
section 20 usb function module rev. 4.00 sep. 14, 2005 page 778 of 982 rej09b0023-0400 20.4.6 ep3 interrupt-in transfer usb function application in token reception data transmission to host set ep3 transmission complete flag (usbifr1/ep3 ts = 1) write data to usbep3 data register (usbepdr3) write 1 to ep3 packet enable bit (usbtrg/ep3 pkte = 1) clear ep3 transmission complete flag (usbifr1/ep3 ts = 0) write data to usbep3 data register (usbepdr3) write 1 to ep3 packet enable bit (usbtrg/ep3 pkte = 1) valid data in ep3 fifo? is there data for transmission to host? is there data for transmission to host? no yes no yes no yes nack ack note: this flowchart shows just one example of interrupt transfer processing. other possibilities include an operation flow in which, if there is data to be transferred, the ep3 de bit in the usb data status register is referenced to confirm that the fifo is empty, and then data is written to the fifo. interrupt request figure 20.12 ep3 interru pt-in transfer operation
section 20 usb function module rev. 4.00 sep. 14, 2005 page 779 of 982 rej09b0023-0400 20.5 processing of usb standard commands and class/vendor commands 20.5.1 processing of commands transmitted by control transfer a command transmitted from the host by control transfer may require decoding and execution of command processing on the application side. whether command decoding is required on the application side is indicated in table 20.2 below. table 20.2 command decoding on application side decoding not necessary on application si de decoding necessary on application side clear feature get configuration get interface get status set address set configuration set feature set interface get descriptor synch frame set descriptor class/vendor command if decoding is not necessary on the application side, command decoding and data stage and status stage processing are performed auto matically. no processing is necessary by the user. an interrupt is not generated in this case. if decoding is necessary on the application side, the usb function module stores the command in the ep0s fifo. after normal recep tion is completed, the usbier0/ setup ts flag is set and an interrupt request is generated. in the interrupt routine, 8 bytes of data must be read from the ep0s data register (usbepdr0s) and decoded by firmware. the necessary data stage and status stage processing should then be carried out accordi ng to the result of the decoding operation.
section 20 usb function module rev. 4.00 sep. 14, 2005 page 780 of 982 rej09b0023-0400 20.6 stall operations this section describes stall operations in the usb function module. there are two cases in which the usb function module stall function is used: ? when the application forcibly sta lls an endpoint for some reason ? when a stall is performed automatically within the usb function module due to a usb specification violation the usb function module has internal status bits that hold the status (sta ll or non-stall) of each endpoint. when a transaction is sent from the host, the module references these internal status bits and determines whether to return a stall to the host. these bits cannot be cleared by the application; they must be cleared with a clear f eature command from the host. the internal status bit for ep0 is automatically cleared only when the se tup command is received. 20.6.1 forcible stall by application the application uses usbepstl register to issue a stall request for the usb function module. when the application wishes to stall a specifi c endpoint, it sets the corresponding bit in usbepstl (1-1 in figure 20.13). the internal stat us bits are not changed. when a transaction is sent from the host for the endpoint for which the usbepstl bit was set, the usb function module references the internal status bit, and if th is is not set, references the corresponding bit in usbepstl (1-2 in figure 20.13). if the correspo nding bit in usbepstl is set, the usb function module sets the internal status bit and returns a sta ll handshake to the host (1-3 in figure 20.13). if the corresponding bit in usbepstl is not set, the internal status bit is not changed and the transaction is accepted. once an internal status bit is set, it remains se t until cleared by a clear feature command from the host, without regard to usbepstl register. even after a bit is cleared by the clear feature command (3-1 in figure 20.13), the usb function module continues to return a stall handshake while the bit in usbepstl is set, since the intern al status bit is set each time a transaction is executed for the corresponding endpoint (1-2 in figu re 20.13). to clear a st all, therefore, it is necessary for the corresp onding bit in usbepstl to be cleared by the application, and also for the internal status bit to be cleared with a cl ear feature command (2-1, 2-2, and 2-3 in figure 20.13).
section 20 usb function module rev. 4.00 sep. 14, 2005 page 781 of 982 rej09b0023-0400 (1) transition from normal operation to stall (1-1) transaction request usb reference (1-2) stall handshake stall to (2-1) or (3-1) normal status restored (1-3) (2) when clear feature is sent after usbepstl is cleared (2-1) stall handshake transaction request (2-2) clear feature command clear feature command (2-3) (3) when clear feature is sent before usbepstl is cleared to 0 (3-1) 1. 1 written to usbepstl by application 1. in/out token received from host 2. usbepstl referenced 1. transmission of stall handshake 1. internal status bit cleared to 0 1. internal status bit cleared to 0 2. usbepstl not changed 1. 1 set in usbepstl 2. internal status bit set to 1 3. transmission of stall handshake 1. usbepstl cleared to 0 by application 2. in/out token received from host 3. internal status bit already set to 1 4. usbepstl not referenced 5. internal status bit not changed to (1-2) internal status bit 0 usbepstl 0 1 internal status bit 0 usbepstl 1 internal status bit 0 1 usbepstl 1 internal status bit 1 usbepstl 1 0 internal status bit 1 usbepstl 0 internal status bit 1 0 usbepstl 0 internal status bit 1 0 usbepstl 1 figure 20.13 forcible stall by application
section 20 usb function module rev. 4.00 sep. 14, 2005 page 782 of 982 rej09b0023-0400 20.6.2 automatic stall by usb function module when a stall setting is made with the set featur e command, or in the event of a usb specification violation, the usb function module automatically sets the internal status bit for the relevant endpoint without regard to usbepstl register, and returns a stall handshake (1-1 in figure 20.14). once an internal status bit is set, it remains se t until cleared by a clear feature command from the host, without regard to usbepstl register. after a bit is cleared by th e clear feature command, usbepstl is referenced (3-1 in figure 20.14). the usb function module continues to return a stall handshake while the internal status bit is set, since the internal status bit is set even if a transaction is executed for the corresponding endpoint (2-1 and 2-2 in figure 20.14). to clear a stall, therefore, the internal status bit must be cleared with a clear featur e command (3-1 in figure 20.14). if set by the application, usbepstl should also be cleared (2-1 in figure 20.14).
section 20 usb function module rev. 4.00 sep. 14, 2005 page 783 of 982 rej09b0023-0400 (1) transition from normal operation to stall (1-1) (2) when transaction is performed when internal status bit is set, and clear feature is sent (2-1) stall handshake transaction request stall handshake (2-2) clear feature command (3) when clear feature is sent before transaction is performed (3-1) 1. in case of usb specification violation, etc., usb function module stalls endpoint automatically 1. transmission of stall handshake 1. internal status bit cleared to 0 2. usbepstl not changed 1. usbepstl cleared to 0 by application 2. in/out token received from host 3. internal status bit already set to 1 4. usbepstl not referenced 5. internal status bit not changed normal status restored internal status bit 0 1 usbepstl 0 internal status bit 1 usbepstl 0 internal status bit 1 usbepstl 0 internal status bit 1 0 usbepstl 0 stall status maintained to (2-1) or (3-1) figure 20.14 automatic stall by usb function module
section 20 usb function module rev. 4.00 sep. 14, 2005 page 784 of 982 rej09b0023-0400 20.7 dma transfer this module allows dmac transfer for endpoints 1 and 2, excluding transfer of word and longword. if endpoint 1 contains at least on e byte of valid receive data, a dma transfer request is issued to endpoint 1. if there is no valid data in endpoint 2, a dma transfer request is issued to endpoint 2. when ep1 dmae in the usbdma setting register is set to 1 to allow dma transfer, 0-length data received for endpoint 1 is ignored. when dma transfer is set, it is unnecessary to write 1 to the ep1 usbtrg/rdfn and ep2 usbtrg/pkte bits. (1 must be written to the usbtrg/pkte bit for data that consists of the ma ximum number of bytes or less.) for ep1, the fifo buffer automatically becomes empty when all the received data is read. for ep2, the fifo automatically becomes full when the maximum number of bytes (64 bytes) is written to the fifo and then the data in the fifo is tr ansmitted. (see figures 20.15 and 20.16.) 20.7.1 dma transfer for endpoint 1 if the received data for ep1 is tr ansferred by dma when the data on the currently selected fifo becomes empty, an equivalent processing of writing 1 to the usbtrg/rdfn bit is automatically performed in the module. therefore, do not write 1 to the ep1rdfn bit in usbtrg after reading the data on one side of the fifo. correct operation cannot be guaranteed. for example, if 150 bytes of data are received from the host, the eq uivalent processing of writing 1 to the usbtrg/rdfn bit is auto matically performed internally in the three places in figure 20.15. this processing is done when the data on the currently selected fifo becomes empty meaning that the processing is to be automatically performed even if 64 bytes of data or less than that are transferred. rdfn (automatically written) rdfn (automatically written) rdfn (automatically written) 64 bytes 64 bytes 22 bytes figure 20.15 ep1 rdfn operation
section 20 usb function module rev. 4.00 sep. 14, 2005 page 785 of 982 rej09b0023-0400 20.7.2 dma transfer for endpoint 2 when the transmitted data for ep2 is transferred by dma when the data on one side of fifo (64 bytes) becomes full an equivalent processing of writing 1 to the usbtrg/pkte bit is automatically performed in the module. therefore, wh en data to be transferred is a multiple of 64 bytes, writing 1 to the usbtrg /pkte bit is not necessary. for the data less than 64 bytes, a 1 should be written to the usbtrg/pkte bit by a dma transfer end interrupt of the dmac. if a 1 is wri tten to the usbtrg/pkte bit for transferring the maximum number of bytes (64 bytes), the correct operation cannot be guaranteed. for example, if 150 bytes of data are transmitted to the host, the equivalent processing if writing 1 to the usbtrg/pkte bit is automatically performed internally in the two places in figure 20.16. this processing is done when the data on the currently selected fifo becomes full meaning that the processing is to be automatically performed only when 64 bytes of data are transferred. when the last 22 bytes are transferred, write 1 to the usbtrg/pkte bit because this is not automatically written to. there is no data to be tr ansferred in the application side, but this module outputs the dma transfer request for ep2 as long as the fifo has a space. when all the data is transferred by dma, wr ite 0 to the usbdma/ep2dmae bit to cancel the dma transfer request for ep2. generate dma transfer end interrput pkte (automatically written) pkte (automatically written) pkte (automatically written) 64 bytes 64 bytes 22 bytes figure 20.16 ep2 pkte operation
section 20 usb function module rev. 4.00 sep. 14, 2005 page 786 of 982 rej09b0023-0400 20.8 example of usb external circuitry usb transceiver: when an on-chip transceiver is not used, a usb transceiver ic (such as a pdiusbp11) must be connected externally. the usb transceiver manufacturer should be consulted concerning the recommended circui t from the usb transceiver to the usb connector, etc. d+ pull-up control: in a system where it is wished to delay usb host/hub connection notification (d+ pull-up) (during high-priority processing or initialization processing, for example), d+ pull-up is controlled using a general output port. when the usb cable has been connected to the host or hub and d+ pull-up is inhibited, d+ and d- are placed in the low level state (d+ and d- are pull down on the host or hub side) and the usb module recognizes as if the usb bus reset has been received from the host. in that case, the d+ pu ll-up control signal and vbus pin input signal should be controlled using a general output port and the usb cable vbus (and circuit) as shown in figure 20.17. (the udc core of this lsi holds the powered state independent of d+ and d- state when the vbus pin is low level.) detection of usb cable co nnection/disconnection: as usb states are managed by hardware in this module, a vbus signal that recognizes co nnection/disconnection is necessary. the power supply signal (vbus) in the usb cable is used for this purpose. however, if the cable is connected to the usb host/hub when the on-chip function lsi power is off, a voltage (5 v) will be applied from the usb host/hub. therefore, an ic (hd74lv1g08a, 2g08a, etc.) that allows voltage application when the system power is off should be co nnected externally.
section 20 usb function module rev. 4.00 sep. 14, 2005 page 787 of 982 rej09b0023-0400 usb module general output port, etc. ic that allows voltage application when the system (lsi) power is off. ic that allows voltage application when the system (lsi) power is off. this lsi usb connector usb cable vbus vbus gnd d+ d+ d- d- 5 v note: operation cannot be guaranteed by this example. when the system requires countermeasures against external surge or esd noise, use the protection diode or noise canceller. 3.3 v figure 20.17 example of usb function module external circuitry (for on-chip transceiver)
section 20 usb function module rev. 4.00 sep. 14, 2005 page 788 of 982 rej09b0023-0400 this lsi usb module general output port, etc. ic that allows voltage application when the system (lsi) power is off. ic that allows voltage application when the system (lsi) power is off. usb connector usb cable vbus vbus txenl txdmns txdpls xvdata dpls gnd dmns suspnd + - suspnd pdiusbp11 etc vm vp rcv oe speed vmo vpo d+ d- note: operation cannot be guaranteed by this example. when the system requires countermeasures against external surge or esd noise, use the protection diode or noise canceller. 5 v 3.3 v figure 20.18 example of usb function module external circuitry (for external transceiver)
section 20 usb function module rev. 4.00 sep. 14, 2005 page 789 of 982 rej09b0023-0400 20.9 usb bus power control method 20.9.1 usb bus power control operation this lsi can operate using a usb bus power control method. the following describes notes on the lsi using the usb bus power control method. changing to high-power function: according to the usb standard, the startup operation (from connecting cables to completing enumeration) is handled as a low-power function. changing to the high-power function can be checked by detecting reception of a set_configuration request from usbifr2 and ifrier2/setc and confirming usbifr2/cfgv = 1. suspending: in this lsi, an interrupt by detecting the usb suspend signal or awake signal can be shared with an irq0 or irq1 interrupt by specifying usbctrl/suspend = 1. (see figure 20.19.) this causes an irq1 interrupt to occur by specifying usbifr2/susps = 1 to change the lsi state to the standby mode. an irq0 interrupt occurs by specifying usbifr2/awake=1, the lsi can be returned from the standby mode. since the lsi must enter the usb suspend state within 10 ms after the usb suspend signal is detected, an irq1 interrupt must be set to be processed prior to other interrupts. when the irq0 interrupt priority is lower than the interrupt request mask level (sr/i[3:0]), the lsi cannot be returned from the suspend state. make sure that the irq0 interrupt priority is higher than the interrupt request mask level (sr/i[3:0]). figure 20.20 shows the operation timing.
section 20 usb function module rev. 4.00 sep. 14, 2005 page 790 of 982 rej09b0023-0400 this lsi irq1 irq1_suspend usbctrl/ suspend usbifr2/ susps usbifr2/ awake irq0_awake irq0 0 s q 1 0 1 usb suspend signal (internal signal) awake signal (internal signal) irq1 interrupt irq0 interrupt interrupt controller (intc) s q figure 20.19 irq0 and irq1 interrupt circuitry usbifr2/susps cleared usbifr2/awake cleared irq0 interrupt detected rte instruction rte instruction peripheral clock irq1_usb suspend irq0_ awake normal operation irq1 interrupt routine standby state irq0 interrupt routine irq1 interrupt routine normal operation irq1 interrupt detected sleep instruction issued figure 20.20 usb standby operation timing 20.9.2 usage example of usb bus power control method figures 20.21 to 20.23 show flowcharts for initializing, entering standby mode and awaking when using the usb bus power control method.
section 20 usb function module rev. 4.00 sep. 14, 2005 page 791 of 982 rej09b0023-0400 normal routine usihp interrupt routine power on reset set stbcr4/mstp46 to 1 (exit usb module stop mode) set usbier2/setc to 1 (configuration set interrupt) clear usbier2/setc clear usbifr2/setc confirm usbifr2/cfgv=1 (confirm that a trasition to high-power function is made) set iprc/irq0 of intc to 15 (set the priority of irq0 to 15) set iprc/irq1 of intc to 14 (set the priority of irq1 to 14) clear icr1/irq00s and irq01s of intc to 0 (set the irq0 falling edge detection) clear icr1/irq10s and irq11s of intc to 0 (set the irq1 falling edge detection) clear icr1/irqe of intc to 0 (irq interrupt enable) set usbctrl/suspend to 1 (suspend interrupt enable) set usbctrl/pwmd to 1 (set to bus power control method) usihp interrupt? no yes normal operation rte instruction figure 20.21 sample flowchart for initializ ation of the usb bus power control method
section 20 usb function module rev. 4.00 sep. 14, 2005 page 792 of 982 rej09b0023-0400 normal routine irq1 interrupt routine normal state clear irr0/irq1r of intc save ssr and spc to memory set stbcr/stby sleep instruction set sr/i[3:0] to the irq1 priority clear irr0/irq0r of intc rte instruction clear usbifr2/susps and awake (clear detection of usb suspend and awake signals) irq1 interrupt? irr0/irq0r of intc? no 1 0 yes normal operation standby mode figure 20.22 sample flowchart for changing the state from usb suspend to standby
section 20 usb function module rev. 4.00 sep. 14, 2005 page 793 of 982 rej09b0023-0400 normal routine irq0 interrupt routine irq1interrupt routine normal state or standby mode clear irr0/irq0r of intc clear irr0/irq1r of intc clear usbifr2/susps and awake set sr/i[3:0] to the irq0 priority rte instruction rte instruction rte instruction restore ssr and spc from memory clear usbifr2/susps and awake irq0 interrupt? irr0/irq1r of intc? no 0 1 yes normal operation figure 20.23 sample flowchart for awake
section 20 usb function module rev. 4.00 sep. 14, 2005 page 794 of 982 rej09b0023-0400 20.10 notes on usage 20.10.1 receiving setup data note that the following when 8-byte setup data is received by usbepdr0s. 1. the usb must always receive the setup comma nd. therefore, writing from the usb bus has priority over reading from the cpu. when th e usb starts receiving the next setup command while the cpu is reading data after data recep tion, the usb forcibly invalidates reading from the cpu to start writing. the value that is re ad after starting reception is undefined. 2. usbepdr0s must be read in 8-byte unit. when reading is stopped in the middle, the data that is received by the next setup co mmand cannot be read correctly. 20.10.2 clearing fifo if the connected usb cable is di sconnected during communicati on, the data being received or transmitted may remain in the fifo. therefore, clear the fifo immediately after connecting the usb cable. do not clear the fifo that is receiving or transmitting data from or to the host. 20.10.3 overreading or ov erwriting data register note that the following when reading or writing the data register of this module: receive data register: do not read the number of data which exceeds that of valid receive data from the receive data register, i. e., data that exceeds the number of bytes indicated by the receive data size register must not be read. for usbepdr1 that has two fifos, the maximum number of bytes that can be read at once is 64 bytes. afte r reading the data on the currently selected side, write 1 to usbtrg/ep1rdfn to change the current side to another side. this allows the number of bytes for the new side to be used as the receive data size, enabling the next data to be read. transmit data register: do not write the number of data th at exceeds the maximum packet size to the transmit data register. for usbepdr2 that has two fifos, the data to be written at one time must be the maximum packet size or less. after writing the data, write 1 to trg/pkte to change the currently selected side to another in the module to allow the next data to be written to the new side. therefore, do not write data to one side of fifo right after the other side.
section 20 usb function module rev. 4.00 sep. 14, 2005 page 795 of 982 rej09b0023-0400 20.10.4 assigning interrupt source for ep0 interrupt sources (bits 0 to 3) for ep0 that are assigned to usbifr0 of this module must be assigned to the same interrupt pin using usbisr0. 20.10.5 clearing fifo wh en setting dma transfer clearing the endpoint 1 data register (usbepdr1) is impossible when dma transfer is enabled (usbdmar/ep1dmae = 1) for endpoint 1. to clear this register, cancel dma transfer. 20.10.6 manual reset for dma transfer do not input a manual reset during dma transfer for endpoints 1 and 2. correct operation cannot be guaranteed. 20.10.7 usb clock input the usb clock (uclk) before setting the register in this module. 20.10.8 using tr interrupt note that the following when using the transfer request interrupt (tr interrupt) for interrupt-in transfer of ep0i/ep2/ep3. the tr interrupt flag is set when the in token is sent from the usb host and there is no data in the fifo of the ep. however, tr interrupts occur continuously at the timing shown in figure 20.24. make sure that no malf unction occurs in these cases. note: this module checks nak acknowledgement if there is no data in the fifo of the ep when receiving the in token. however the tr interrupt flag is set after transmitting the nak handshake. therefore, when writing the usbtrg/pkte bit is later than the next in token, the tr interrupt flag is set again.
section 20 usb function module rev. 4.00 sep. 14, 2005 page 796 of 982 rej09b0023-0400 tr interrupt routine tr interrupt routine cpu usb clear tr flag, write transmit data, and trg/pkte in token check nak set tr flag host nak in token check nak set tr flag (flag is set again) nak in token data transmission ack figure 20.24 timing for se tting the tr interrupt flag
section 21 a/d converter rev. 4.00 sep. 14, 2005 page 797 of 982 rej09b0023-0400 section 21 a/d converter this lsi includes a 10-bit successive-approximation a/d converter allowing selection of up to eight analog input channels. the a/d converter is composed of two independent modules, a/d0 and a/d1. 21.1 features a/d converter features are listed below. ? 10-bit resolution ? eight input channels (4 channels 2) ? high-speed conversion ? conversion time: maximum 4.4 s per channel (in single mode, 146-state conversion (typ.), p = 33 mhz operation) ? three conversion modes ? single mode: a/d conversion on one channel ? multi mode: a/d conversion on one to four channels ? scan mode: continuous a/d conversion on one to four channels ? conversion can be carried out simultaneously on two channels. ? two conversion start methods ? software or timer conversion start trigger (mtu) can be selected ? eight 16-bit data registers ? a/d conversion results are transferred for storage into 16-bit data registers corresponding to the channels. ? sample-and-hold function ? a/d interrupt requested at the end of conversion ? an a/d conversion end interrupt (adi0, adi1) request can be generated on completion of a/d conversion. ? the dmac can be activated by a/d conversion end.
section 21 a/d converter rev. 4.00 sep. 14, 2005 page 798 of 982 rej09b0023-0400 21.1.1 block diagram figure 21.1 shows a block diagram of the a/d converter. avcc and avss for both a/d modules are common pins in the chip. adi0 interrupt signal adcsr 0: addra 0: addrb 0: addrc 0: addrd 0: adcr: [legend] a/d 0 control/status register a/d 0 data register a a/d 0 data register b a/d 0 data register c a/d 0 data register d a/d0, a/d1 control register adcsr 1: addra 1: addrb 1: addrc 1: addrd 1: a/d 1 control/status register a/d 1 data register a a/d 1 data register b a/d 1 data register c a/d 1 data register d 10 bit a/d addra1 addrb1 addrc1 addrd1 bus interface bus peripheral data bus analog multi plecer control circuit successive approxi- mation register + ? comparator sample and- hold circuit adi1 interrupt signal av ss an4 an5 an6 an7 an0 an1 an2 an3 adcsr1 av cc a/d converter 1 internal data bus 10 bit a/d addra0 addrb0 addrc0 addrd0 bus interface bus peripheral data bus analog multi plecer control circuit successive approxi- mation register + ? comparator sample and- hold circuit mtu trigger av ss adcsr0 av cc a/d converter 0 internal data bus adcr figure 21.1 block di agram of a/d converter
section 21 a/d converter rev. 4.00 sep. 14, 2005 page 799 of 982 rej09b0023-0400 21.1.2 input pins table 21.1 summarizes the a/d converter's input pins. the eight analog input pins are divided into two groups: a/d0 (an0 to an3), and a/d1 (an4 to an7). av cc and av ss are the power supply inputs for the analog circuits in the a/d converter. av cc also functions as the a/d converter reference voltage pin. av ss also functions as the a/d converter reference ground pin. table 21.1 a/d converter pins pin name abbreviation i/o function analog power supply pin avcc input analog power supply and reference voltage for a/d conversion analog ground pin avss input analog ground and reference ground for a/d conversion analog input pin 0 an0 input analog input pin 1 an1 input analog input pin 2 an2 input analog input pin 3 an3 input a/d0 analog inputs analog input pin 4 an4 input analog input pin 5 an5 input analog input pin 6 an6 input analog input pin 7 an7 input a/d1 analog inputs
section 21 a/d converter rev. 4.00 sep. 14, 2005 page 800 of 982 rej09b0023-0400 21.1.3 register configuration the a/d converter's registers are summarized below. ? a/d0 data register a (addra0) ? a/d0 data register b (addrb0) ? a/d0 data register c (addrc0) ? a/d0 data register d (addrd0) ? a/d0 control/status register (adcsr0) ? a/d1 data register a (addra1) ? a/d1 data register b (addrb1) ? a/d1 data register c (addrc1) ? a/d1 data register d (addrd1) ? a/d1 control/status register (adcsr1) ? a/d0 a/d1 control register (adcr) 21.2 register descriptions 21.2.1 a/d data registers a to d (addra0 to addrd0, addra1 to addrd1) the eight a/d data registers (addra0 to addrd0, addra1 to addrd1) are 16-bit read- only registers that store the results of a/d conversion. an a/d conversion produces 10-bit data, which is transferred for storage into the a/d data register corresponding to the selected channel. the 10 bits of the result are stored in the upper bits (bits 15 to 6) of the a/d data register. bits 5 to 0 of an a/d data register are reserved bits that are always read as 0. table 21.2 indicates the pairings of analog input channels and a/d data registers. the a/d data registers are initialized to h'0000 by a power-on reset and in standby mode.
section 21 a/d converter rev. 4.00 sep. 14, 2005 page 801 of 982 rej09b0023-0400 table 21.2 analog input cha nnels and a/d data registers analog input channel a/d data register module an0 addra0 an1 addrb0 an2 addrc0 an3 addrd0 a/d0 an4 addra1 an5 addrb1 an6 addrc1 an7 addrd1 a/d1 21.2.2 a/d control/status registers (adcsr0, adcsr1) adcsr is a 16-bit readable/writable register that selects the mode, controls the a/d converter, and enable or disable starting of a/d conversion by external trigger input. adcsr is initialized to h'0040 by a power-on reset and in standby mode. bit bit name initial value r/w description 15 adf 0 r/(w) * a/d end flag indicates the end of a/d conversion. [clearing conditions] ? cleared by reading adf while adf = 1, then writing 0 to adf ? cleared when dmac is activated by adi interrupt and addr is read [setting conditions] ? single mode: a/d conversion ends ? multi mode: a/d conversion ends cycling through the selected channels ? scan mode: a/d conversion ends cycling through the selected channels
section 21 a/d converter rev. 4.00 sep. 14, 2005 page 802 of 982 rej09b0023-0400 bit bit name initial value r/w description 14 adie 0 r/w a/d interrupt enable enables or disables the inte rrupt (adi) requested at the end of a/d conversion. set the adie bit while a/d conversion is not being made. 0: a/d end interrupt request (adi) is disabled 1: a/d end interrupt request (adi) is enabled 13 adst 0 r/w a/d start starts or stops a/d conversion. the adst bit remains set to 1 during a/d conversion. 0: a/d conversion is stopped 1: a/d conversion is started single mode: a/d conversion starts; adst is automatically cleared to 0 when conversion ends on all selected channels multi mode: a/d conversion starts; when conversion is completed cycling through the selected channels, adst is automatically cleared scan mode: a/d conversion starts and continues, a/d conversion is continuously performed until adst is cleared to 0 by software, by a power-on reset, or by a transition to standby mode 12 dmasl 0 r/w dmac select selects an interrupt due to the end of a/d conversion or activation of the dmac. set the dmasl bit while a/d conversion is not being made. 0: an interrupt by the end of a/d conversion is selected 1: activation of the dmac by the end of a/d conversion is selected 11 trge 0 r/w a/d trigger enable this bit enables or disables starting of a/d conversion by mtu or csl trigger. 0: start of a/d conversion by mtu or csl trigger input is disabled 1: a/d conversion is started mtu or csl trigger input
section 21 a/d converter rev. 4.00 sep. 14, 2005 page 803 of 982 rej09b0023-0400 bit bit name initial value r/w description 10 to 8 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 7 6 cks1 cks0 0 1 r/w r/w clock select selects the a/d conversion time. clear the adst bit to 0 before changing the conversion time. 00: conversion time = 151 states (maximum) clock = p /4 01: conversion time = 285 states (maximum) clock = p /8 10: conversion time = 545 states (maximum) clock = p /16 11: reserved 5 4 multi1 multi0 0 0 r/w r/w these bits select single mode, multi mode, or scan mode. 00: single mode 01: reserved (setting prohibited) 10: multi mode 11: scan mode 3, 2 ? all 0 r reserved these bits are always read as 0. the write value should always be 0.
section 21 a/d converter rev. 4.00 sep. 14, 2005 page 804 of 982 rej09b0023-0400 bit bit name initial value r/w description 1 0 ch1 ch0 0 0 r/w r/w channel select these bits and the multi bi t select the analog input channels. clear the adst bit to 0 before changing the channel selection. ? in the case of adcsr0 (a/d0) single mode multi mode or scan mode 00: an0 an0 01: an1 an0, an1 10: an2 an0 to an2 11: an3 an0 to an3 ? in the case of adscr1 (a/d1) single mode multi mode or scan mode 00: an4 an4 01: an5 an4, an5 10: an6 an4 to an6 11: an7 an4 to an7 note: * clear this bit by writing 0. 21.2.3 a/d0, a/d1 control register (adcr) adcr is a 16-bit readable/writable register that selects the simultaneous sampling of two channels. see section 21.3.4 simultaneous sampling operation, for details on simultaneous sampling. adcr is initialized to h'0000 by a power-on reset and in standby mode. bit bit name initial value r/w description 15 dsmp 0 r/w selects a/d0 or a/d1 simultaneous sampling. starts simultaneous sampling of two channels when the dsmp bit set to 1. the ds mp bit remains set to 1 during a/d conversion. dsmp is automatically cleared to 0 when conversion ends on all selected channels by each one mode. note: set the adcsr regist ers before dsmp bit set. 14 to 0 ? all 0 r reserved these bits are always read as 0. the write value should always be 0.
section 21 a/d converter rev. 4.00 sep. 14, 2005 page 805 of 982 rej09b0023-0400 21.3 operation the a/d converter operates by su ccessive approximations with 10 -bit resolution. it has three operating modes: single mode, multi mode, and scan mode. 21.3.1 single mode single mode should be selected when only one a/d conversion on one channel is required. a/d conversion starts when the adst bit is set to 1 by software. the adst bit remains set to 1 during a/d conversion and is automatically cleared to 0 when conversion ends. when conversion ends the adf bit is set to 1. if the adie bit is also set to 1, an adi interrupt is requested at this time. to clear the adf flag to 0, first read adf, then write 0 to adf. when the mode or analog input channel must be switched during a/d conversion, to prevent incorrect operation, first clear the adst bit to 0 to halt a/d conversion. after making the necessary changes, set the adst bit to 1 to start a/d conversion again. the adst bit can be set at the same time as the mode or channel is changed. typical operations when channel 1 (an1) is selected in single mode are described next. figure 21.2 shows a timing diagram for th is example. 1. single mode is selected (mu lti = 0), input channel an1 is se lected (ch1 = 0, ch0 = 1), the a/d interrupt is enabled (adie = 1), and a/d conversion is started (adst = 1). 2. when a/d conversion is completed, the resu lt is transferred into addrb0. at the same time the adf flag is set to 1, the adst bit is cleared to 0, and the a/d converter becomes idle. 3. since adf = 1, adie = 1, and dmsl = 0 an adi0 interrupt is requested. 4. the a/d interrupt handling routine starts. 5. the routine reads adf, and then writes 0 to the adf flag. 6. the routine reads and processes the conversion result (addrb0). 7. execution of the a/d interrupts handling routine ends. then, when the adst bit is set to 1, a/d conversion starts and steps 2 to 7 are executed.
section 21 a/d converter rev. 4.00 sep. 14, 2005 page 806 of 982 rej09b0023-0400 channel 0 (an0) operating adie adst adf channel 1 (an1) operating channel 2 (an2) operating channel 3 (an3) operating addra addrb addrc addrd waiting waiting waiting waiting waiting waiting a/d conversion starts set* set* set* clear* clear* a/d conversion result 1 a/d conversion result 2 read result read result a/d conversion 1 a/d conversion result 2 note: * vertical arrows ( ) indicate instruction execution by software. figure 21.2 example of a/d converter op eration (single mode, channel 1 selected) 21.3.2 multi mode multi mode should be selected when performing a/d conversions on one or more channels. when the adst bit is set to 1 by software, a/d conversion starts on the first channel in the group (a/d0 when an0, a/d1 when an4). when two or more channels are selected, after conversion of the first channel ends, conversion of the second channel (an1 or an5) starts immediately. when a/d conversions end on the selected ch annels, the adst bit is cleared to 0. the conversion results are transferred for storage into the a/d data registers corresponding to the channels. when the mode or analog input channel selection must be changed during a/d conversion, to prevent incorrect operation, first clear the adst bi t to 0 to halt a/d conversion. after making the necessary changes, set the adst bit to 1. a/d conv ersion will start again fr om the first channel in the group. the adst bit can be set at the same tim e as the mode or channel selection is changed.
section 21 a/d converter rev. 4.00 sep. 14, 2005 page 807 of 982 rej09b0023-0400 typical operations when three channels in a/d0 (an0 to an2) are selected in multi mode are described next. figure 21.3 shows a timing diagram for this example. 1. multi mode is selected (multi = 1), channel group a/d0 is selected, analog input channels an0 to an2 are selected (ch1 = 1, ch0 = 0), and a/d conversion is started (adst = 1). 2. when a/d conversion of the first channel (an0 ) is completed, the result is transferred into addra0. 3. next, conversion of the second channel (an1) starts automatically. 4. conversion proceeds in the same way through the third channel (an2). 5. when conversion of all selected channels (an0 to an2) is completed, the adf flag is set to 1 and adst bit is cleared to 0. if the adie bit is set to 1, an adi0 interrupt is requested at this time. channel 0 (an0) operating adst adf channel 1 (an1) operating channel 2 (an2) operating channel 3 (an3) operating addra addrb addrc addrd waiting waiting waiting waiting set* clear* clear a/d conversion result 2 waiting waiting a/d conversion result 3 a/d conversion 1 waiting a/d conversion result 1 transfer a/d conversion 3 a/d conversion a/d conversion 2 note: * vertical arrows ( ) indicate instruction execution by software. figure 21.3 example of a/d converter operation (multi mode, channels an0 to an2 selected)
section 21 a/d converter rev. 4.00 sep. 14, 2005 page 808 of 982 rej09b0023-0400 21.3.3 scan mode scan mode is useful for monitoring analog inputs in a group of one or more channels. when the adst bit in the a/d control/status register (adcsr0 or adcsr1) is set to 1 by software, a/d conversion starts on the first channel in the group (a/d0 when an0, a/d1 when an4). when two or more channels are selected, after conversion of the first channel ends, conversion of the second channel (an1 or an5) starts immediately. a/d conversion continues cycl ically on the selected channels until the adst bit is cl eared to 0. the conversion result s are transferred for storage into the a/d data registers corresponding to the channels. when the mode or analog input channel must be changed during analog conversion, to prevent incorrect operation, first clear the adst bit to 0 to halt a/d conversion. after making the necessary changes, set the adst bit to 1. a/d conv ersion will start again fr om the first channel in the group. the adst bit can be set at the same tim e as the mode or channel selection is changed. typical operations when three ch annels (an0 to an2) are selected in scan mode are described next. figure 21.4 shows a timing diagram for this example. 1. scan modes are selected, analog input channels an0 to an2 are selected (ch1 = 1, ch0 = 0), and a/d conversion is started (adst = 1). 2. when a/d conversion of the first channel (an0 ) is completed, the result is transferred into addra0. 3. next, conversion of the second channel (an1) starts automatically. 4. conversion proceeds in the same way through the third channel (an2). 5. when conversion of all the selected channels (a n0 to an2) is complete d, the adf flag is set to 1 and conversion of the first channel (an0) starts again. if the adie bit is set to 1, an adi0 interrupt is requested at this time. 6. the adst bit is not cleared au tomatically. steps 2 to 4 are rep eated as long as the adst bit remains set to 1. when steps 2 to 4 are repeated , the adf flag is keep to 1. when the adst bit is cleared to 0, a/d conver sion stops. the adf bit cleared by reading adf while adf=1, then writing 0 to adf. 7. if the adie bit is set to 1 and the adf flag is set to 1 in steps 2 to 4 are repeated, an adi0 interrupt is requested ad all times. when an adi0 interrupt is requested at conversion ends of all the selected channels, the adf bit is cleared to 0 after an adi0 interrupt is requested.
section 21 a/d converter rev. 4.00 sep. 14, 2005 page 809 of 982 rej09b0023-0400 adst adf channel 0 (an0) operating channel 1 (an1) operating channel 2 (an2) operating channel 3 (an3) operating addra0 addrb0 addrc0 addrd0 waiting waiting waiting waiting waiting waiting waiting waiting waiting transfer a/d conversion 1 a/d conversion 4 a/d conversion 2 a/d conversion 3 a/d conversion result 1 a/d conversion result 4 a/d conversion result 2 a/d conversion result 3 clear* 1 clear* 1 set* 1 continuous a/d conversion a/d conversion 5 notes: 1. vertical arrows ( ) indicate instruction execution by software. 2. a/d conversion data is invalid/ * 2 figure 21.4 example of a/d converter operation (scan mode, channels an0 to an2 selected) 21.3.4 simultaneous sampling operation with simultaneous sampling, conversion is conducted with sampling of the input voltages on two channels (channel in a/d0 and channel in a/d1) at the same time. simultaneous sampling is valid in single mode and multi mode and scan mode. channels for sampling are determined by the ch1 and ch0 bits of the adcsr0 or adcsr1. procedure for setting simultaneous sampling is shown the next. select the adcsr registers (conversion mode and input channels and conversion time), and then starts simultaneous sampling of two channels when the dsmp bit set to 1. when dsmp bit set to 1 during a/d conversion, not to start a/d conversion again. when the adst bit is set, a/d conversion stops. the timing diagrams for simultaneous sampling are the same as for single mode and multi mode and scan mode.
section 21 a/d converter rev. 4.00 sep. 14, 2005 page 810 of 982 rej09b0023-0400 21.3.5 a/d converter activation by mtu the a/d converter can be independently activated by an a/d conversion request from the mtu or csl. to activate the a/d converter by the mtu, set the a/d trigger enable bit (trge). after this bit setting has been made, the adst bit in adcsr is automatically set to 1 and a/d conversion is started when an a/d conversion request from the mtu occurs. if the trge bit in both adcsr0 and adcsr1 is set to 1, starts simultaneous sampling of two channels. channels for sampling are determined by the ch1 and ch0 bits of the adcs r0 or adcsr1. the timing from setting of the adst bit until the start of a/d conversion is the same as when 1 is written to the adst bit by software. 21.3.6 input sampling and a/d conversion time the a/d converter has a built-in sample-and-hold circuit. the a/d converter samples the analog input at a time t d after the adst bit is set to 1, then star ts conversion. figure 21.5 shows the a/d conversion timing. table 21.3 indicates the a/d conversion time. as indicated in figure 21.5, th e a/d conversion time includes t d and the input sampling time. the length of t d varies depending on the timing of the wr ite access to adcsr. th e total conversion time therefore varies w ithin the ranges indicated in table 21.3. in multi mode and scan mode, the values given in table 21.3 apply to the first conversion. in the second and subsequent conversions time is the values given in table21.4.
section 21 a/d converter rev. 4.00 sep. 14, 2005 page 811 of 982 rej09b0023-0400 p write signal adf adcsr write cycle input sampling timing t d : a/d conversion start delay t spl : input sampling time t conv : a/d conversion time [legend] address adcsr address t d t spl t conv figure 21.5 a/d conversion timing table 21.3 a/d conversio n time (single mode) cks1 = 1, cks0 = 1 cks1 = 1, cks0 = 1 cks1 = 1, cks0 = 1 symbol min. typ. max. min. typ. max. min. typ. max. a/d conversion start delay t d 18 ? 21 10 ? 13 6 ? 9 input sampling time t spl ? 129 ? ? 65 ? ? 33 ? a/d conversion time t conv 535 ? 545 275 ? 285 141 ? 151 note: values in the table are numbers of states (t cyc ). table 21.4 a/d conversion time (multi mode and scan mode) cks1 cks0 conversion time (t cyc ) 0 128 (constant) 0 1 256 (constant) 0 512 (constant) 1 1 reserved
section 21 a/d converter rev. 4.00 sep. 14, 2005 page 812 of 982 rej09b0023-0400 21.4 interrupt and dmac transfer request the a/d converter generates an interrupt (adi0 and adi1) or dmac activation signal at the end of a/d conversion. these requests are enabled or disabled by the adie bit or the dmasl bit in adcsr. when the dmac is activated by an adi interrupt, the adf bit in the a/d control/status register (adcsr0 and adcsr1) is automatically cleared to 0 when an a/d register is accessed. table 21.5 interrupt an d dmac transfer request adie bit dmasl bit interrupt dmac transfer request 0 disabled disabled 0 1 disabled enabled 0 enabled disabled 1 1 disabled enabled
section 21 a/d converter rev. 4.00 sep. 14, 2005 page 813 of 982 rej09b0023-0400 21.5 definitions of a/d conversion accuracy the a/d converter compares an analog value input from an analog input channel with its analog reference value and converts it to 10-bit digital data. the absolute accuracy of this a/d conversion is the deviation between the input analog value and the output digital value. it includes the following errors: ? offset error ? full-scale error ? quantization error ? nonlinearity error these four error quantities are explained below with reference to figure 21.6. in the figure, the 10 bits of the a/d converter have been simplified to 3 bits. offset error is the deviation between actual an d ideal a/d conversion characteristics when the digital output value changes from the minimum (zero voltage) 0000000000 (000 in the figure) to 000000001 (001 in the figure)(figure 21.6, item (1)). full-scale error is the deviation between actual and ideal a/d conversion characteristics when the digital output value changes from the 1111111110 (110 in the figure) to the maximum 1111111111 (111 in the figure)(figure 21.6, item (2)). quantization error is the intrinsic error of the a/d converter and is expressed as 1/2 lsb (figure 21.6, item (3)). nonlinearity error is the de viation between actual an d ideal a/d conversion characteristics between zero voltage and full-scale voltage (figure 21.6, item (4)). note that it does not include offset, full-scal e, or quantization error.
section 21 a/d converter rev. 4.00 sep. 14, 2005 page 814 of 982 rej09b0023-0400 0f s 111 110 101 100 011 010 001 000 analog input voltage (3) quantization error (4) nonlinearity error (2) full-scale error ideal a/d conversion characteristic digital output fs: full-scale voltage fs analog input voltage actual a/d convertion characteristic (1) offset error ideal a/d conversion characteristic digital output 1024 1 1024 2 1024 1022 1024 1023 figure 21.6 definitions of a/d conversion accuracy
section 21 a/d converter rev. 4.00 sep. 14, 2005 page 815 of 982 rej09b0023-0400 21.6 usage notes when using the a/d converter, note the following points. 21.6.1 setting analog input voltage permanent damage to the lsi may result if the following voltag e ranges are exceeded. 1. analog input range: during a/d conversion, voltages on the analog input pins ann should not go beyond the following range: avss ann avcc (n = 0 to 7). 2. avcc and avss input voltages: input voltages avcc and avss should be vccq ? 0.2 v avcc vccq and avss = vss. do not leave the avcc and avss pins open when the a/d converter is not in use and during periods in standby mode; in these situations, connect avcc to the power supply (vccq) and avss to the ground (vssq). 21.6.2 processing of analog input pins to prevent damage from voltage surges at the analog input pins (an0 to an7), connect an input protection circuit like the one shown in figure 21.7. the circuit shown also includes an rc filter to suppress noise. this circuit is shown as an example; the circuit constants should be selected according to actual application co nditions. section 25.4, a/d conver ter characteristics in section 25, electrical characteristics shows the analog input pin specifications and figure 21.8 shows an equivalent circuit diagram of the analog input ports. 21.6.3 permissible si gnal source impedance this lsi's analog input is designed such that conversion precision is guaranteed for an input signal for which the signal source impedance is 5k ? or less. this specification is provided to enable the a/d converter's sample-and-hold circuit input capacitance to be charged within the sampling time; if the sensor output impedance exceeds 5k ? , charging may be insufficient and it may not be possible to guarantee a/d conversi on precision. however, for a/d conversion in single mode with a large capacitance provided externally for a/d conversion in single mode, the input load will essentially comprise only the internal input resistance of 3k ? , and the signal source impedance is ignored. however, as a low-pass filter effect is obtained in this case, it may not be possible to follow an analog signal with a larg e differential coefficient (e.g., 5mv/ s or greater) (see figure 21.9). when converting a high-speed analog signal, a low-impedance buffer should be inserted.
section 21 a/d converter rev. 4.00 sep. 14, 2005 page 816 of 982 rej09b0023-0400 21.6.4 influences on absolute precision adding capacitance results in coupling with gnd, and therefor e noise in gnd may adversely affect absolute precision . be sure to make the connection to an electrically stable gnd such as avss. care is also required to insure that filter circuits do not communicate with digital signals on the mounting board (i.e., acting as antennas). 21.6.5 stop during a/d conversion when a/d conversion is stopped with a program during a/d conversion, see the following notes. 1. in single mode, a/d conversion cannot be stopped with a program during a/d conversion. 2. in multi mode or scan mode, when a/d conversion is stopped with a program during a/d conversion, write 0 only to the adst bit. if the adst bit and the other bits are set simultaneously, the operation of a/d conversion cannot be guaranteed. 3. in multi mode or scan mode, when a/d conversion is stopped during a/d conversion, write 0 to the adst bit. and then the adst bit is set 1 after the time which is longer than the a/d conversion time has elapsed. 4. when the value of the adst bit is changed, the period which is longer then one clock cycle selected by the cks[1:0] bits in adcsr0 and adcsr1 must be kept because the adst bit is sampling by the clock cycle selected by the setting of the cks bits. if the period until the next change of the adst bit is shorter, that change may not be detected correctly.
section 21 a/d converter rev. 4.00 sep. 14, 2005 page 817 of 982 rej09b0023-0400 0.01 f 10 f av cc an0 to an7 av ss this lsi * 1 1. 100 ? 0.1 f note: value are referene value. * 2 r in 2. r in : input impedance figure 21.7 example of analog input protection circuit an0 to an7 3 k? 20 pf to a/d converter note: value are referene value. figure 21.8 analog input pin equivalent circuit sensor input this lsi sensor output impeddance low-pass filter c to 0.1 f up to 3 k? cin = 15pf 20pf 3 k? note: value are referene value. a/d converter equivalent circuit figure 21.9 example of analog input circuit
section 21 a/d converter rev. 4.00 sep. 14, 2005 page 818 of 982 rej09b0023-0400
section 22 pin function controller (pfc) rev. 4.00 sep. 14, 2005 page 819 of 982 rej09b0023-0400 section 22 pin function controller (pfc) the pin function controller (pfc) is composed of registers for selecting the function of multiplexed pins and the input/output direction. the pin function and input/output direction can be selected for each pin individually without regard to the operating mode of the chip. table 22.1 lists the multiplexed pins. table 22.1 list of multiplexed pins port port function (related module) other function (related module) a pta14 input/output (port) a25 output (address bus) pta13 input/output (port) a24 output (address bus) pta12 input/output (port) a23 output (address bus) pta11 input/output (port) a22 output (address bus) pta10 input/output (port) a21 output (address bus) pta9 input/output (port) a20 output (address bus) pta8 input/output (port) a19 output (address bus) pta7 input/output (port) rasu output (bsc) pta6 input/output (port) rasl output (bsc) pta5 input/output (port) casu output (bsc) pta4 input/output (port) casl output (bsc) pta3 input/output (port) cs3 output (bsc) pta2 input/output (port) cs2 output (bsc) pta1 input/output (port) cke output (bsc) pta0 input/output (port) a0 output (address bus) b ptb8 input/output (port) dpls input (usb) ptb7 input/output (port) dmns input (usb) ptb6 input/output (port) txdpls output (usb) ptb5 input/output (port) txdmns output (usb) ptb4 input/output (por t) txenl output (usb) ptb3 input/output (port) xvdata input (usb) ptb2 input/output (port) suspnd output (usb) ptb1 input/output (port) vbus input (usb) ptb0 input/output (port) uclk input (usb)
section 22 pin function controller (pfc) rev. 4.00 sep. 14, 2005 page 820 of 982 rej09b0023-0400 port port function (related module) other function (related module) c ptc15 input/output (por t) status1 output (cpg) ptc14 input/output (port) status0 output (cpg) ptc13 input/output (port) asebrkak output (cpu) ptc12 input/output (port) dack1 output (dmac) ptc11 input/output (port) dack0 output (dmac) ptc10 input/output (port) dreq1 input (dmac) ptc9 input/output (port) dreq0 input (dmac) ptc8 input/output (port) tend output (dmac) ptc7 input/output (port) back output (bsc) ptc6 input/output (port) breq input (bsc) ptc5 input/output (port) frame output (bsc) ptc4 input/output (port) cs6b output (bsc) ptc3 input/output (port) cs6a output (bsc) ptc2 input/output (port) cs5b output (bsc) ptc1 input/output (port) cs5a output (bsc) ptc0 input/output (port) cs4 output (bsc) d ptd15 input/output (port) d31 input/output (data bus) ptd14 input/output (port) d30 input/output (data bus) ptd13 input/output (port) d29 input/output (data bus) ptd12 input/output (port) d28 input/output (data bus) ptd11 input/output (port) d27 input/output (data bus) ptd10 input/output (port) d26 input/output (data bus) ptd9 input/output (port) d25 input/output (data bus) ptd8 input/output (port) d24 input/output (data bus) ptd7 input/output (port) d23 input/output (data bus) ptd6 input/output (port) d22 input/output (data bus) ptd5 input/output (port) d21 input/output (data bus) ptd4 input/output (port) d20 input/output (data bus) ptd3 input/output (port) d19 input/output (data bus) ptd2 input/output (port) d18 input/output (data bus) ptd1 input/output (port) d17 input/output (data bus) ptd0 input/output (port) d16 input/output (data bus)
section 22 pin function controller (pfc) rev. 4.00 sep. 14, 2005 page 821 of 982 rej09b0023-0400 port port function (related module) other function (related module) e pte15 input/output (port) tioc0a input/output (mtu) pte14 input/output (port) tioc0b input/output (mtu) pte13 input/output (port) tioc0c input/output (mtu) pte12 input/output (port) tioc0d input/output (mtu) pte11 input/output (port) tioc1a input/output (mtu) pte10 input/output (port) tioc1b input/output (mtu) pte9 input/output (port) tioc2a input/output (mtu) pte8 input/output (port) tioc2b input/output (mtu) pte7 input/output (port) tioc3a input/output (mtu) pte6 input/output (port) tioc3b input/output (mtu) pte5 input/output (port) tioc3c input/output (mtu) pte4 input/output (port) tioc3d input/output (mtu) pte3 input/output (port) tioc4a input/output (mtu) pte2 input/output (port) tioc4b input/output (mtu) pte1 input/output (port) tioc4c input/output (mtu) pte0 input/output (port) tioc4d input/output (mtu) f ptf15 input/output (port) poe3 input (mtu) ptf14 input/output (port) poe2 input (mtu) ptf13 input/output (port) poe1 input (mtu) ptf12 input/output (port) poe0 input (mtu) ptf11 input/output (port) tclka input (mtu) ptf10 input/output (port) tclkb input (mtu) ptf9 input/output (port) tclkc input (mtu) ptf8 input/output (port) tclkd input (mtu) ptf7 input/output (port) ? ptf6 input/output (port) ? ptf5 input/output (port) ? ptf4 input/output (port) ? ptf3 input/output (port) ? ptf2 input/output (port) ? ptf1 input/output (port) ? ptf0 input/output (port) ?
section 22 pin function controller (pfc) rev. 4.00 sep. 14, 2005 page 822 of 982 rej09b0023-0400 port port function (related module) other function (related module) g ptg13 input/output (port) ? ptg12 input/output (port) ? ptg11 input/output (port) ? ptg10 input/output (port) sda input/output (iic2) ptg9 input/output (port) sdl input/output (iic2) ptg8 input/output (port) ? ptg7 input (port) an7 input (adc) ptg6 input (port) an6 input (adc) ptg5 input (port) an5 input (adc) ptg4 input (port) an4 input (adc) ptg3 input (port) an3 input (adc) ptg2 input (port) an2 input (adc) ptg1 input (port) an1 input (adc) ptg0 input (port) an0 input (adc) h pth14 input/output (port) rts2 input/output (scif2) pth13 input/output (port) rxd2 input (scif2) pth12 input/output (port) txd2 output (scif2) pth11 input/output (port) cts2 input/output (scif2) pth10 input/output (port) sck2 input/output (scif2) pth9 input/output (port) rts1 input/output (scif1) pth8 input/output (port) rxd1 input (scif1) pth7 input/output (port) txd1 output (scif1) pth6 input/output (port) cts1 input/output (scif) pth5 input/output (port) sck1 input/output (scif1) pth4 input/output (port) rts0 input/output (scif0) pth3 input/output (port) rxd0 input (scif0) pth2 input/output (port) txd0 output (scif0) pth1 input/output (port) cts0 input/output (scif0) pth0 input/output (port) sck0 input/output (scif0)
section 22 pin function controller (pfc) rev. 4.00 sep. 14, 2005 page 823 of 982 rej09b0023-0400 port port function (related module) other function (related module) j ptj12 input/output (port) audsync output (aud) ptj11 input/output (port) audata3 output (aud) ptj10 input/output (port) audata2 output (aud) ptj9 input/output (port) audata1 output (aud) ptj8 input/output (port) audata0 output (aud) ptj7 input/output (port) irq7 input (intc) ptj6 input/output (port) irq6 input (intc) ptj5 input/output (port) irq5 input (intc) ptj4 input/output (port) irq4 input (intc) ptj3 input/output (port) irq3 input (intc) ptj2 input/output (port) irq2 input (intc) ptj1 input/output (port) irq1 input (intc) ptj0 input/output (port) irq0 input (intc) 22.1 register descriptions the registers of the pin function controller are shown below. ? port a control register (pacr) ? port b control register (pbcr) ? port c control register (pccr) ? port d control register (pdcr) ? port e control register (pecr) ? port e i/o register (peior) ? port e mtu r/w enable register (pemturwer) ? port f control register (pfcr) ? port g control register (pgcr) ? port h control register (phcr) ? port j control register (pjcr)
section 22 pin function controller (pfc) rev. 4.00 sep. 14, 2005 page 824 of 982 rej09b0023-0400 22.1.1 port a control register (pacr) pacr is a 32-bit readable/writable register that selects the pin functions. pacr is initialized to h ' 00000000 by a power-on reset, and it is not initialized by a manual reset, in standby mode, or in sleep mode. bit bit name initial value r/w description 31, 30 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 29 28 pa14md2 pa14md1 0 0 r/w r/w 27 26 pa13md2 pa13md1 0 0 r/w r/w 25 24 pa12md2 pa12md1 0 0 r/w r/w 23 22 pa11md2 pa11md1 0 0 r/w r/w 21 20 pa10md2 pa10md1 0 0 r/w r/w 19 18 pa9md2 pa9md1 0 0 r/w r/w 17 16 pa8md2 pa8md1 0 0 r/w r/w 15 14 pa7md2 pa7md1 0 0 r/w r/w 13 12 pa6md2 pa6md1 0 0 r/w r/w 11 10 pa5md2 pa5md1 0 0 r/w r/w 9 8 pa4md2 pa4md1 0 0 r/w r/w pan mode 2 and 1 the combination of bits panmd2 and panmd1 (n = 0 to 14) controls the pin functions. 00: port input 01: port output 10: reserved (when set, correct operation cannot be guaranteed.) 11: other functions (see table 22.1.)
section 22 pin function controller (pfc) rev. 4.00 sep. 14, 2005 page 825 of 982 rej09b0023-0400 bit bit name initial value r/w description 7 6 pa3md2 pa3md1 0 0 r/w r/w 5 4 pa2md2 pa2md1 0 0 r/w r/w 3 2 pa1md2 pa1md1 0 0 r/w r/w 1 0 pa0md2 pa0md1 0 0 r/w r/w pan mode 2 and 1 the combination of bits panmd2 and panmd1 (n = 0 to 14) controls the pin functions. 00: port input 01: port output 10: reserved (when set, correct operation cannot be guaranteed.) 11: other functions (see table 22.1.) note: the initial function of the port a is por t input after a power-on reset. when rom with more than 256 kbytes is allocated to space0, st rong pull-downs must be prepared on the user board to input 0 to the upper address bits of the rom immediately after a power-on reset.
section 22 pin function controller (pfc) rev. 4.00 sep. 14, 2005 page 826 of 982 rej09b0023-0400 22.1.2 port b control register (pbcr) pbcr is a 32-bit readable/writable register that selects the pin functions. pbcr is initialized to h ' 00000000 by a power-on reset, and it is not initialized by a manual reset, in standby mode, or in sleep mode. bit bit name initial value r/w description 31 to 18 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 17 16 pb8md2 pb8md1 0 0 r/w r/w 15 14 pb7md2 pb7md1 0 0 r/w r/w 13 12 pb6md2 pb6md1 0 0 r/w r/w 11 10 pb5md2 pb5md1 0 0 r/w r/w 9 8 pb4md2 pb4md1 0 0 r/w r/w 7 6 pb3md2 pb3md1 0 0 r/w r/w 5 4 pb2md2 pb2md1 0 0 r/w r/w 3 2 pb1md2 pb1md1 0 0 r/w r/w 1 0 pb0md2 pb0md1 0 0 r/w r/w pbn mode 2 and 1 the combination of bits pbnmd2 and pbnmd1 (n = 0 to 8) controls the pin functions. 00: port input 01: port output 10: reserved (when set, correct operation cannot be guaranteed.) 11: other functions (see table 22.1.)
section 22 pin function controller (pfc) rev. 4.00 sep. 14, 2005 page 827 of 982 rej09b0023-0400 22.1.3 port c control register (pccr) pccr is a 32-bit readable/writable register that selects the pin functions. pccr is initialized to h ' 0c000000 by a power-on reset, and it is not initialized by a manual reset, in standby mode, or in sleep mode. bit bit name initial value r/w description 31 30 pc15md2 pc15md1 0 0 r/w r/w 29 28 pc14md2 pc14md1 0 0 r/w r/w 27 26 pc13md2 pc13md1 1 1 r/w r/w 25 24 pc12md2 pc12md2 0 0 r/w r/w 23 22 pc11md2 pc11md1 0 0 r/w r/w 21 20 pc10md2 pc10md1 0 0 r/w r/w 19 18 pc9md2 pc9md1 0 0 r/w r/w 17 16 pc8md2 pc8md1 0 0 r/w r/w 15 14 pc7md2 pc7md1 0 0 r/w r/w 13 12 pc6md2 pc6md1 0 0 r/w r/w 11 10 pc5md2 pc5md1 0 0 r/w r/w 9 8 pc4md2 pc4md1 0 0 r/w r/w pcn mode 2 and 1 the combination of bits pcnmd2 and pcnmd1 (n = 0 to 15) controls the pin functions. 00: port input 01: port output 10: reserved (when set, correct operation cannot be guaranteed.) 11: other functions (see table22.1.)
section 22 pin function controller (pfc) rev. 4.00 sep. 14, 2005 page 828 of 982 rej09b0023-0400 bit bit name initial value r/w description 7 6 pc3md2 pc3md1 0 0 r/w r/w 5 4 pc2md2 pc2md1 0 0 r/w r/w 3 2 pc1md2 pc1md1 0 0 r/w r/w 1 0 pc0md2 pc0md1 0 0 r/w r/w pcn mode 2 and 1 the combination of bits pcnmd2 and pcnmd1 (n = 0 to 15) controls the pin functions. 00: port input 01: port output 10: reserved (when set, correct operation cannot be guaranteed.) 11: other functions (see table22.1.) 22.1.4 port d control register (pdcr) pdcr is a 32-bit readable/writable register that selects the pin functions. pdcr is initialized to h ' 00000000 (md3 = 0, 16-bit bus width) or h ' ffffffff (md3 = 1, 32-bit bus width) by a power-on reset, and it is not initialized by a manu al reset, in standby mode, or in sleep mode. bit bit name initial value r/w description 31 30 pd15md2 pd15md1 0/1 0/1 r/w r/w 29 28 pd14md2 pd14md1 0/1 0/1 r/w r/w 27 26 pd13md2 pd13md1 0/1 0/1 r/w r/w 25 24 pd12md2 pd12md1 0/1 0/1 r/w r/w 23 22 pd11md2 pd11md1 0/1 0/1 r/w r/w 21 20 pd10md2 pd10md1 0/1 0/1 r/w r/w 19 18 pd9md2 pd9md1 0/1 0/1 r/w r/w pdn mode 2 and 1 the combination of bits pdnmd2 and pdnmd1 (n = 0 to 15) controls the pin functions. 00: port input 01: port output 10: reserved (when set, correct operation cannot be guaranteed.) 11: other functions (see table22.1.)
section 22 pin function controller (pfc) rev. 4.00 sep. 14, 2005 page 829 of 982 rej09b0023-0400 bit bit name initial value r/w description 17 16 pd8md2 pd8md1 0/1 0/1 r/w r/w 15 14 pd7md2 pd7md1 0/1 0/1 r/w r/w 13 12 pd6md2 pd6md1 0/1 0/1 r/w r/w 11 10 pd5md2 pd5md1 0/1 0/1 r/w r/w 9 8 pd4md2 pd4md1 0/1 0/1 r/w r/w 7 6 pd3md2 pd3md1 0/1 0/1 r/w r/w 5 4 pd2md2 pd2md1 0/1 0/1 r/w r/w 3 2 pd1md2 pd1md1 0/1 0/1 r/w r/w 1 0 pd0md2 pd0md1 0/1 0/1 r/w r/w pdn mode 2 and 1 the combination of bits pdnmd2 and pdnmd1 (n = 0 to 15) controls the pin functions. 00: port input 01: port output 10: reserved (when set, correct operation cannot be guaranteed.) 11: other functions (see table22.1.)
section 22 pin function controller (pfc) rev. 4.00 sep. 14, 2005 page 830 of 982 rej09b0023-0400 22.1.5 port e control register (pecr) pecr is a 32-bit readable/writable register that selects the pin functions. pecr is initialized to h ' 00000000 by a power-on reset, and it is not initialized by a manual reset, in standby mode, or in sleep mode. bit bit name initial value r/w description 31 30 pe15md2 pe15md1 0 0 r/w r/w 29 28 pe14md2 pe14md1 0 0 r/w r/w 27 26 pe13md2 pe13md1 0 0 r/w r/w 25 24 pe12md2 pe12md1 0 0 r/w r/w 23 22 pe11md2 pe11md1 0 0 r/w r/w 21 20 pe10md2 pe10md1 0 0 r/w r/w 19 18 pe9md2 pe9md1 0 0 r/w r/w 17 16 pe8md2 pe8md1 0 0 r/w r/w 15 14 pe7md2 pe7md1 0 0 r/w r/w 13 12 pe6md2 pe6md1 0 0 r/w r/w 11 10 pe5md2 pe5md1 0 0 r/w r/w 9 8 pe4md2 pe4md1 0 0 r/w r/w pen mode 2 and 1 the combination of bits penmd2 and penmd1 (n = 0 to 15) controls the pin functions. 00: port input 01: port output 10: reserved (when set, correct operation cannot be guaranteed.) 11: other functions (see table 22.1.) when 11 (other functions) is set, the port e i/o register (peior) controls input or output. for details, see section 22.1.6, port e i/o register (peior).
section 22 pin function controller (pfc) rev. 4.00 sep. 14, 2005 page 831 of 982 rej09b0023-0400 bit bit name initial value r/w description 7 6 pe3md2 pe3md1 0 0 r/w r/w 5 4 pe2md2 pe2md1 0 0 r/w r/w 3 2 pe1md2 pe1md1 0 0 r/w r/w 1 0 pe0md2 pe0md1 0 0 r/w r/w pen mode 2 and 1 the combination of bits penmd2 and penmd1 (n = 0 to 15) controls the pin functions. 00: port input 01: port output 10: reserved (when set, correct operation cannot be guaranteed.) 11: other functions (see table 22.1.) when 11 (other functions) is set, the port e i/o register (peior) controls input or output. for details, see section 22.1.6, port e i/o register (peior).
section 22 pin function controller (pfc) rev. 4.00 sep. 14, 2005 page 832 of 982 rej09b0023-0400 22.1.6 port e i/o register (peior) peior is a 16-bit readable/writable register that selects the input/output direction of the port e pins. the pe15ior to pe0ior bits correspond to the pe15/tioc0a to pe0/tioc4d pins. peior is valid only when the port e pins function as the tioc pins of the mtu (other functions). otherwise, peior is invalid. when the port e pins function as the tioc pins of the mtu (other functions), setting a bit in peior to 1 sets the pin to output and setting a bit in peior to 0 sets the pin to input. peior is initialized to h ' 0000 by a power-on reset, and it is not initialized by a manual reset, in standby mode, or in sleep mode. bit bit name initial value r/w description 15 pe15ior 0 r/w 14 pe14ior 0 r/w 13 pe13ior 0 r/w 12 pe12ior 0 r/w 11 pe11ior 0 r/w 10 pe10ior 0 r/w 9 pe9ior 0 r/w 8 pe8ior 0 r/w 7 pe7ior 0 r/w 6 pe6ior 0 r/w 5 pe5ior 0 r/w 4 pe4ior 0 r/w 3 pe3ior 0 r/w 2 pe2ior 0 r/w 1 pe1ior 0 r/w 0 pe0ior 0 r/w when the port e pins function as the tioc pins of the mtu (other functions): penior (n = 0 to 15) controls the input/output direction of the pins. 0: mtu input capture input 1: mtu output compare output peior is invalid when the port e pins function as pins other than the tioc pins of the mtu.
section 22 pin function controller (pfc) rev. 4.00 sep. 14, 2005 page 833 of 982 rej09b0023-0400 22.1.7 port e mtu r/w enable register (pemturwer) pemturwer is a 16-bit readable/writable regist er that allows access of the mtu registers. pemturwer is initialized to h ' 0001 by a power-on reset, and it is not initialized by a manual reset, in standby mode, or in sleep mode. bit bit name initial value r/w description 15 to 1 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 0 mturwe 1 r/w mturwe allows acce ss of the mtu registers. for details, see section 18, mult i-function timer pulse unit (mtu). 0: disables access of the mtu registers. 1: enables access of the mtu registers.
section 22 pin function controller (pfc) rev. 4.00 sep. 14, 2005 page 834 of 982 rej09b0023-0400 22.1.8 port f control register (pfcr) pfcr is a 32-bit readable/writable register that selects the pin functions. pfcr is initialized to h ' 00000000 by a power-on reset, and it is not initialized by a manual reset, in standby mode, or in sleep mode. bit bit name initial value r/w description 31 30 pf15md2 pf15md1 0 0 r/w r/w 29 28 pf14md2 pf14md1 0 0 r/w r/w 27 26 pf13md2 pf13md1 0 0 r/w r/w 25 24 pf12md2 pf12md2 0 0 r/w r/w 23 22 pf11md2 pf11md2 0 0 r/w r/w 21 20 pf10md2 pf10md2 0 0 r/w r/w 19 18 pf9md2 pf9md2 0 0 r/w r/w 17 16 pf8md2 pf8md2 0 0 r/w r/w pfn mode 2 and 1 the combination of bits pf nmd2 and pfnmd1controls the pin functions. (n = 8 to 15) 00: port input 01: port output 10: reserved (when set, correct operation cannot be guaranteed.) 11: other functions (see table22.1.)
section 22 pin function controller (pfc) rev. 4.00 sep. 14, 2005 page 835 of 982 rej09b0023-0400 bit bit name initial value r/w description 15 14 pf7md2 pf7md2 0 0 r/w r/w 13 12 pf6md2 pf6md2 0 0 r/w r/w 11 10 pf5md2 pf5md2 0 0 r/w r/w 9 8 pf4md2 pf4md2 0 0 r/w r/w 7 6 pf3md2 pf3md2 0 0 r/w r/w 5 4 pf2md2 pf2md2 0 0 r/w r/w 3 2 pf1md2 pf1md2 0 0 r/w r/w 1 0 pf0md2 pf0md2 0 0 r/w r/w pfn mode 2,1 the combination of bits pf nmd2 and pfnmd1 controls the pin functions. (n = 0 to 7) 00: port input 01: port output 10, 11: reserved (when set, correct operation cannot be guaranteed.)
section 22 pin function controller (pfc) rev. 4.00 sep. 14, 2005 page 836 of 982 rej09b0023-0400 22.1.9 port g control register (pgcr) pgcr is a 32-bit readable/writable register that selects the pin functions. pgcr is initialized to h ' 00000000 by a power-on reset, and it is not initialized by a manual reset, in the standby mode, or in the sleep mode. bit bit name initial value r/w description 31 to 28 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 27 26 pg13md2 pg13md1 0 0 r/w r/w 25 24 pg12md2 pg12md2 0 0 r/w r/w 23 22 pg11md2 pg11md2 0 0 r/w r/w pgn mode 2 and 1 the combination of bits pgnmd2 and pgnmd1 controls the pin functions. (n = 11 to 13) 00: port input 01: port output 10, 11: reserved (when set, correct operation cannot be guaranteed.) 21 20 pg10md2 pg10md2 0 0 r/w r/w 19 18 pg9md2 pg9md2 0 0 r/w r/w pgn mode 2 and 1 the combination of bits pgnmd2 and pgnmd1 controls the pin functions. (n = 9 and 10) 00: port input 01: port output 10: reserved (when set, correct operation cannot be guaranteed.) 11: other functions (see table22.1.) 17 16 pg8md2 pg8md2 0 0 r/w r/w pg8 mode 2 and 1 the combination of bits pg8md2 and pg8nmd1 controls the pin functions. 00: port input 01: port output 10, 11: reserved (when set, correct operation cannot be guaranteed.)
section 22 pin function controller (pfc) rev. 4.00 sep. 14, 2005 page 837 of 982 rej09b0023-0400 bit bit name initial value r/w description 15 14 pg7md2 pg7md2 0 0 r/w r/w 13 12 pg6md2 pg6md2 0 0 r/w r/w 11 10 pg5md2 pg5md2 0 0 r/w r/w 9 8 pg4md2 pg4md2 0 0 r/w r/w 7 6 pg3md2 pg3md2 0 0 r/w r/w 5 4 pg2md2 pg2md2 0 0 r/w r/w 3 2 pg1md2 pg1md2 0 0 r/w r/w 1 0 pg0md2 pg0md2 0 0 r/w r/w pgn mode 2 and 1 the combination of bits pgnmd2 and pgnmd1 controls the pin functions. (n = 0 to 7) 00: port input/other functions (see table22.1.) 01, 10, 11: reserved (when set, correct operation cannot be guaranteed.) note: there is no bit for changing the function of port g (pins ann: analog inputs for the a/d converter) between input and other functions because the function returns to input on completion of a/d conversion.
section 22 pin function controller (pfc) rev. 4.00 sep. 14, 2005 page 838 of 982 rej09b0023-0400 22.1.10 port h control register (phcr) phcr is a 32-bit readable/writable register that selects the pin functions. phcr is initialized to h ' 00000000 by a power-on reset, and it is not initialized by a manual reset, in standby mode, or in sleep mode. bit bit name initial value r/w description 31, 30 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 29 28 ph14md2 ph14md1 0 0 r/w 27 26 ph13md2 ph13md1 0 0 r/w 25 24 ph12md2 ph12md2 0 0 r/w 23 22 ph11md2 ph11md2 0 0 r/w 21 20 ph10md2 ph10md2 0 0 r/w 19 18 ph9md2 ph9md2 0 0 r/w 17 16 ph8md2 ph8md2 0 0 r/w 15 14 ph7md2 ph7md2 0 0 r/w 13 12 ph6md2 ph6md2 0 0 r/w 11 10 ph5md2 ph5md2 0 0 r/w 9 8 ph4md2 ph4md2 0 0 r/w phn mode 2 and 1 the combination of bits phnmd2 and phnmd1controls the pin functions. (n = 0 to 14) 00: port input 01: port output 10: reserved (when set, correct operation cannot be guaranteed.) 11: other functions (see table22.1.)
section 22 pin function controller (pfc) rev. 4.00 sep. 14, 2005 page 839 of 982 rej09b0023-0400 bit bit name initial value r/w description 7 6 ph3md2 ph3md2 0 0 r/w 5 4 ph2md2 ph2md2 0 0 r/w 3 2 ph1md2 ph1md2 0 0 r/w 1 0 ph0md2 ph0md2 0 0 r/w phn mode 2 and 1 the combination of bits phnmd2 and phnmd1controls the pin functions. (n = 0 to 14) 00: port input 01: port output 10: reserved (when set, correct operation cannot be guaranteed.) 11: other functions (see table22.1.) 22.1.11 port j control register (pjcr) pjcr is a 32-bit readable/writable register that selects the pin functions. pjcr is initialized to h ' 00000000 by a power-on reset, and it is not initialized by a manual reset, in standby mode, or in sleep mode. bit bit name initial value r/w description 31 to 25 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 25 24 pj12md2 pj12md2 0 0 r/w 23 22 pj11md2 pj11md2 0 0 r/w 21 20 pj10md2 pj10md2 0 0 r/w 19 18 pj9md2 pj9md2 0 0 r/w 17 16 pj8md2 pj8md2 0 0 r/w 15 14 pj7md2 pj7md2 0 0 r/w pjn mode 2 and 1 the combination of bits pjnmd2 and pjnmd1controls the pin functions. (n = 0 to 12) 00: port input 01: port output 10: reserved (when set, correct operation cannot be guaranteed.) 11: other functions (see table 22.1)
section 22 pin function controller (pfc) rev. 4.00 sep. 14, 2005 page 840 of 982 rej09b0023-0400 bit bit name initial value r/w description 13 12 pj6md2 pj6md2 0 0 r/w 11 10 pj5md2 pj5md2 0 0 r/w 9 8 pj4md2 pj4md2 0 0 r/w 7 6 pj3md2 pj3md2 0 0 r/w 5 4 pj2md2 pj2md2 0 0 r/w 3 2 pj1md2 pj1md2 0 0 r/w 1 0 pj0md2 pj0md2 0 0 r/w pjn mode 2 and 1 the combination of bits pjnmd2 and pjnmd1controls the pin functions. (n = 0 to 12) 00: port input 01: port output 10: reserved (when set, correct operation cannot be guaranteed.) 11: other functions (see table 22.1)
section 22 pin function controller (pfc) rev. 4.00 sep. 14, 2005 page 841 of 982 rej09b0023-0400 22.2 i/o buffer internal block diagram 22.2.1 i/o buffer with weak keeper all the i/o buffers except ptg10, ptg9, and ptg 7 to ptg 0 (iic2 and analog pins) listed in table 22.1 have weak keepers that consist of two inverters to keep the status of the pin. figure 22.1 shows the internal block diagram of the i/o buffer. output enalbe output data input data weak keeper i/o buffer figure 22.1 internal block diagra m of i/o buffer with weak keeper 22.2.2 i/o buffer with open drain output ptg10 and ptg9 are multiplexed with the iic2 (s da, scl) pins and consist of the normal i/o buffer and the i/o buffer with an open drain output. setting the port g control register (pgcr) to port input or port output enables the normal i/o buffer. setting the pgcr to other function (iic2) enables the i/o buffer with an open drain output. figure 22.2 shows the internal block diagram of the i/o buffer with an open drain output.
section 22 pin function controller (pfc) rev. 4.00 sep. 14, 2005 page 842 of 982 rej09b0023-0400 sda input data scl input data sda output data scl output data ptg[10] output enable ptg[9] output enable ptg[10] output data ptg[9] output data ptg[10] input data ptg[9] input data ptg[10] /sda ptg[9] /scl figure 22.2 internal block diag ram of i/o buffer with open drain 22.3 notes on usage ? pins function as outputs when other function is selected by the port control register when the pin function (shown in table 22.1, list of multiplexed pins) is changed from other function (output) to port function (input), the weak keeper in figure 22.1 holds the value of the port data register of the pin. ? pins function as inputs/outputs when other function is selected by the port control register when the pin function (shown in table 22.1, list of multiplexed pins) is changed from port function (input) to other function (output), the weak keeper in figure 22.1 holds the other function value of the pin. ? pins ptg10 and ptg9 the i/o buffers of pg10 and ptg9 have no weak keeper. when you do not use these pins, pull up or pull down them. if you use them as port input, do not apply mid-voltage. ? pins with weak keepers immediately after a power-on reset, the level of the pin which has a weak keeper is not undefined whether high or low. thus, to fix the pin level, the pin needs to be pulled up or down. reference pull-up and pull-down resistances are shown below. these resistances change according to the circuit configuration. pull-up resistance (reference value) = 2 k ? pull-down resistance (reference value) = 8 k ?
section 23 i/o ports rev. 4.00 sep. 14, 2005 page 843 of 982 rej09b0023-0400 section 23 i/o ports this lsi has nine 16-bit ports (ports a to j). all port pins are multiplexed with other pin functions (the pin function controller (pfc) handles the selection of pin functions). each port has a data register which stores data for the pins. 23.1 port a port a is a 15-bit input/output port with the pin configuration shown in figure 23.1. each pin is controlled by the port a control register (pacr) in the pfc. pta14 (input/output)/a25 (output) port a pta13 (input/output)/a24 (output) pta12 (input/output)/a23 (output) pta11 (input/output)/a22 (output) pta10 (input/output)/a21 (output) pta9 (input/output)/a20 (output) pta8 (input/output)/a19 (output) pta7 (input/output)/ rasu (output) pta6 (input/output)/ rasl (output) pta5 (input/output)/ casu (output) pta4 (input/output)/ casl (output) pta3 (input/output)/ cs3 (output) pta2 (input/output)/ cs2 (output) pta1 (input/output)/cke (output) pta0 (input/output)/a0 (output) figure 23.1 port a 23.1.1 register description port a has the following register. ? port a data register (padr)
section 23 i/o ports rev. 4.00 sep. 14, 2005 page 844 of 982 rej09b0023-0400 23.1.2 port a data register (padr) padr is a 15-bit readable/writable register with one reserved bit that stores data for pins pta14 to pta0. padr is initialized to h ' 0000 by a power-on reset, but it retains its previous value by a manual reset, in standby mode or in sleep mode. bit bit name initial value r/w description 15 ? 0 r reserved this bit is always read as 0. the write value should always be 0. 14 pa14dt 0 r/w 13 pa13dt 0 r/w 12 pa12dt 0 r/w 11 pa11dt 0 r/w 10 pa10dt 0 r/w 9 pa9dt 0 r/w 8 pa8dt 0 r/w 7 pa7dt 0 r/w 6 pa6dt 0 r/w 5 pa5dt 0 r/w 4 pa4dt 0 r/w 3 pa3dt 0 r/w 2 pa2dt 0 r/w 1 pa1dt 0 r/w 0 pa0dt 0 r/w bits pa14dt to pa0dt correspond to pins pta14 to pta0. when the pin function is general output port, the value of the corresponding padr bit in padr is returned directly by reading the port. when the function is general input port, the corresponding pin level is read by reading the port. table 23.1 shows the function of padr.
section 23 i/o ports rev. 4.00 sep. 14, 2005 page 845 of 982 rej09b0023-0400 table 23.1 port a data register (padr) read/write operations panmd2 panmd1 pin function read write 0 0 input pin state data is wri tten to padr, but does not affect pin state. 1 output padr value data is written to padr and the value is output from the pin. 1 0 reserved ? ? 1 other functions pin state data is written to padr, but does not affect pin state. (n = 0 to 14) 23.2 port b port b is a 9-bit input/output port with the pin configuration shown in figure 23.2. each pin is controlled by the port b control register (pbcr) in the pfc. ptb8 (input/output)/dpls (input) port b ptb7 (input/output)/dmns (input) ptb6 (input/output)/txdpls (output) ptb5 (input/output)/txdmns (output) ptb4 (input/output)/txenl (output) ptb3 (input/output)/xvdata (input) ptb2 (input/output)/suspnd (output) ptb1 (input/output)/vbus (input) ptb0 (input/output)/uclk (input) figure 23.2 port b 23.2.1 register description port b has the following register. ? port b data register (pbdr)
section 23 i/o ports rev. 4.00 sep. 14, 2005 page 846 of 982 rej09b0023-0400 23.2.2 port b data register (pbdr) pbdr is a 9-bit readable/writable register with seven reserved bits that stores data for pins ptb8 to ptb0. pbdr is initialized to h ' 0000 by a power-on reset, but it retains its previous value by a manual reset, in standby mode, or in sleep mode. bit bit name initial value r/w description 15 to 9 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 7 pb7dt 0 r/w 6 pb6dt 0 r/w 5 pb5dt 0 r/w 4 pb4dt 0 r/w 3 pb3dt 0 r/w 2 pb2dt 0 r/w 1 pb1dt 0 r/w 0 pb0dt 0 r/w bits pb8dt to pb0dt corre spond to pins ptb8 to ptb0. when the pin function is general output port, the value of the corresponding bit in pbdr is returned directly by reading the port. when the function is general input port, the corresponding pin level is read by reading the port. table 23.2 shows the function of pbdr. table 23.2 port b data regist er (pbdr) read/write operations pbnmd2 pbnmd1 pin state read write 0 0 input pin state data is wri tten to pbdr, but does not affect pin state. 1 output pbdr value data is written to pbdr and the value is output from the pin. 1 0 reserved ? ? 1 other functions pin state data is written to pbdr, but does not affect pin state. (n = 0 to 8)
section 23 i/o ports rev. 4.00 sep. 14, 2005 page 847 of 982 rej09b0023-0400 23.3 port c port c is a 16-bit input/output port with the pin configuration shown in figure 23.3. each pin is controlled by the port c control register (pccr) in the pfc. port c ptc15 (input/output)/status1 (output) ptc14 (input/output)/status0 (output) ptc13 (input/output)/asebrkak (output) ptc12 (input/output)/dack1 (output) ptc11 (input/output)/dack0 (output) ptc10 (input/output)dreq1 (input) ptc9 (input/output)/dreq0 (input) ptc8 (input/output)/tend (output) ptc7 (input/output)/back (output) ptc6 (input/output)/breq (input) ptc5 (input/output)/frame (output) ptc4 (input/output)/cs6b (output) ptc3 (input/output)/cs6a (output) ptc2 (input/output)/cs5b (output) ptc1 (input/output)/cs5a (output) ptc0 (input/output)/cs4 (output) figure 23.3 port c 23.3.1 register description port c has the following register. ? port c data register (pcdr)
section 23 i/o ports rev. 4.00 sep. 14, 2005 page 848 of 982 rej09b0023-0400 23.3.2 port c data register (pcdr) pcdr is a 16-bit readable/writable register that stores data for pins ptc15 to ptc0. pcdr is initialized to h ' 0000 by a power-on reset, but it retains its previous value by a manual reset, in standby mode, or in sleep mode. bit bit name initial value r/w description 15 pc15dt 0 r/w 14 pc14dt 0 r/w 13 pc13dt 0 r/w 12 pc12dt 0 r/w 11 pc11dt 0 r/w 10 pc10dt 0 r/w 9 pc9dt 0 r/w 8 pc8dt 0 r/w 7 pc7dt 0 r/w 6 pc6dt 0 r/w 5 pc5dt 0 r/w 4 pc4dt 0 r/w 3 pc3dt 0 r/w 2 pc2dt 0 r/w 1 pc1dt 0 r/w 0 pc0dt 0 r/w bits pc15dt to pc0dt correspond to pins ptc15 to ptc0. when the pin function is general output port, the value of the corresponding bit in pcdr is returned directly by reading the port. when the function is general input port, the corresponding pin level is read by reading the port. table 23.3 shows the function of pcdr.
section 23 i/o ports rev. 4.00 sep. 14, 2005 page 849 of 982 rej09b0023-0400 table 23.3 port c data register (pcdr) read/write operations pcnmd2 pcnmd1 pin state read write 0 0 input pin state data is writt en to pcdr, but does not affect pin state. 1 output pcdr value data is written to pcdr and the value is output from the pin. 1 0 reserved ? ? 1 other functions pin state data is wr itten to pcdr, but does not affect pin state. (n = 0 to 15) 23.4 port d port d comprises a 16-bit input/output port with the pin configuration shown in figure 23.4. each pin is controlled by the port d control register (pdcr) in the pfc. port d ptd15 (input/output)/d31 (input/output) ptd14 (input/output)/d30 (input/output) ptd13 (input/output)/d29 (input/output) ptd12 (input/output)/d28 (input/output) ptd11 (input/output)/d27 (input/output) ptd10 (input/output)/d26 (input/output) ptd9 (input/output)/d25 (input/output) ptd8 (input/output)/d24 (input/output) ptd7 (input/output)/d23 (input/output) ptd6 (input/output)/d22 (input/output) ptd5 (input/output)/d21 (input/output) ptd4 (input/output)/d20 (input/output) ptd3 (input/output)/d19 (input/output) ptd2 (input/output)/d18 (input/output) ptd1 (input/output)/d17 (input/output) ptd0 (input/output)/d16 (input/output) figure 23.4 port d
section 23 i/o ports rev. 4.00 sep. 14, 2005 page 850 of 982 rej09b0023-0400 23.4.1 register description port d has the following register. ? port d data register (pddr) 23.4.2 port d data register (pddr ) pddr is a 16-bit readable/writable register that stores data for pins ptd15 to ptd0. pddr is initialized to h ' 0000 by a power-on reset, after which the general input port function is set as the initial pin function, and the corresponding pin leve ls are read when md3 = 0 (16-bit bus width in cs0 space) is set. pddr retains its previous value by a manual reset, in standby mode, or in sleep mode. bit bit name initial value r/w description 15 pd15dt 0 r/w 14 pd14dt 0 r/w 13 pd13dt 0 r/w 12 pd12dt 0 r/w 11 pd11dt 0 r/w 10 pd10dt 0 r/w 9 pd9dt 0 r/w 8 pd8dt 0 r/w 7 pd7dt 0 r/w 6 pd6dt 0 r/w 5 pd5dt 0 r/w 4 pd4dt 0 r/w 3 pd3dt 0 r/w 2 pd2dt 0 r/w 1 pd1dt 0 r/w 0 pd0dt 0 r/w bits pd15dt to pd0dt correspond to pins ptd15 to ptd0. when the pin function is general output port, the value of the corresponding bit in pddr is returned directly by reading the port. when the function is general input port, the corresponding pin level is read by reading the port. table 23.4 shows the function of pddr.
section 23 i/o ports rev. 4.00 sep. 14, 2005 page 851 of 982 rej09b0023-0400 table 23.4 port d data register (pddr) read/write operations pdnmd2 pdnmd1 pin state read write 0 0 input pin state data is writt en to pddr, but does not affect pin state. 1 output pddr value data is written to pddr and the value is output from the pin. 1 0 reserved ? ? 1 other function pin state data is written to pddr, but does not affect pin state. (n = 0 to 15) 23.5 port e port e is a 16-bit input/output port with the pin configuration shown in figure 23.5. each pin is controlled by the port e control register (pecr) in the pfc. port e pte15 (input/output)/tioc0a (input/output) pte14 (input/output)/tioc0b (input/output) pte13 (input/output)/tioc0c (input/output) pte12 (input/output)/tioc0d (input/output) pte11 (input/output)/tioc1a (input/output) pte10 (input/output)/tioc1b (input/output) pte9 (input/output)/tioc2a (input/output) pte8 (input/output)/tioc2b (input/output) pte7 (input/output)/tioc3a (input/output) pte6 (input/output)/tioc3b (input/output) pte5 (input/output)/tioc3c (input/output) pte4 (input/output)/tioc3d (input/output) pte3 (input/output)/tioc4a (input/output) pte2 (input/output)/tioc4b (input/output) pte1 (input/output)/tioc4c (input/output) pte0 (input/output)/tioc4d (input/output) figure 23.5 port e
section 23 i/o ports rev. 4.00 sep. 14, 2005 page 852 of 982 rej09b0023-0400 23.5.1 register description port e has the following register. ? port e data register (pedr) 23.5.2 port e data register (pedr) pedr is a 16-bit readable/writable register that st ores data for pins pte15 to pte0. the pedr is initialized to h ' 0000 by a power-on reset, but it retains its previous value by a manual reset, in standby mode, or in sleep mode. bit bit name initial value r/w description 15 pe15dt 0 r/w 14 pe14dt 0 r/w 13 pe13dt 0 r/w 12 pe12dt 0 r/w 11 pe11dt 0 r/w 10 pe10dt 0 r/w 9 pe9dt 0 r/w 8 pe8dt 0 r/w 7 pe7dt 0 r/w 6 pe6dt 0 r/w 5 pe5dt 0 r/w 4 pe4dt 0 r/w 3 pe3dt 0 r/w 2 pe2dt 0 r/w 1 pe1dt 0 r/w 0 pe0dt 0 r/w bits pe15dt to pe0dt correspond to pins pte15 to pte0. when the pin function is general output port, the value of the corresponding pedr bit in pedr is returned directly by reading the port. when the function is general input port, the corresponding pin level is read by reading the port. table 23.5 shows the function of pedr.
section 23 i/o ports rev. 4.00 sep. 14, 2005 page 853 of 982 rej09b0023-0400 table 23.5 port e data regist er (pedr) read/write operations penmd2 penmd1 pin state read write 0 0 input pin state data is wri tten to pedr, but does not affect pin state. 1 output pedr value data is written to pedr and the value is output from the pin. 1 0 reserved ? ? 1 other function pin state data is written to pedr, but does not affect pin state. (n = 0 to 15) 23.6 port f port f is a 16-bit input port with the pin configuration shown in figure 23.6. each pin is controlled by the port f control register (pfcr) in the pfc. port f ptf15 (input/output)/poe3 (input) ptf14 (input/output)/poe2 (input) ptf13 (input/output)/poe1 (input) ptf12 (input/output)/poe0 (input) ptf11 (input/output)/tclka (input) ptf10 (input/output)/tclkb (input) ptf9 (input/output)/tclkc (input) ptf8 (input/output)/tclkd (input) ptf7 (input/output) ptf6 (input/output) ptf5 (input/output) ptf4 (input/output) ptf3 (input/output) ptf2 (input/output) ptf1 (input/output) ptf0 (input/output) figure 23.6 port f
section 23 i/o ports rev. 4.00 sep. 14, 2005 page 854 of 982 rej09b0023-0400 23.6.1 register description port f has the following register. ? port f data register (pfdr) 23.6.2 port f data register (pfdr) pfdr is a 16-bit readable/writable register that stores data for pins ptf15 to ptf0. pfdr is initialized to h ' 0000 by a power-on reset, but it retains its previous value by a manual reset, in standby mode, or in sleep mode. bit bit name initial value r/w description 15 pf15dt 0 r/w 14 pf14dt 0 r/w 13 pf13dt 0 r/w 12 pf12dt 0 r/w 11 pf11dt 0 r/w 10 pf10dt 0 r/w 9 pf9dt 0 r/w 8 pf8dt 0 r/w 7 pf7dt 0 r 6 pf6dt 0 r 5 pf5dt 0 r/w 4 pf4dt 0 r/w 3 pf3dt 0 r/w 2 pf2dt 0 r/w 1 pf1dt 0 r/w 0 pf0dt 0 r/w bits pf15dt to pf0dt correspond to pins ptf15 to ptf0. when the function is general input port, the corresponding pin level is read by reading the port. tables 23.6 and 23.7 show the function of pfdr.
section 23 i/o ports rev. 4.00 sep. 14, 2005 page 855 of 982 rej09b0023-0400 table 23.6 port f data register (pfdr) read/write op erations (pf15dt to pf8dt) pfnmd2 pfnmd1 pin state read write 0 0 input pin state data is wri tten to pfdr, but does not affect pin state. 1 output pfdr value data is written to pfdr and the value is output from the pin. 1 0 reserved ? ? 1 other function pin state data is written to pfdr, but does not affect pin state. (n = 8 to 15) table 23.7 port f data re gister (pfdr) read/write operations (pf7dt to pf0dt) pfnmd2 pfnmd1 pin state read write 0 0 input pin state data is wri tten to pfdr, but does not affect pin state. 1 output pfdr value data is written to pfdr and the value is output from the pin. other than above reserved ? ? (n = 0 to 7)
section 23 i/o ports rev. 4.00 sep. 14, 2005 page 856 of 982 rej09b0023-0400 23.7 port g port g comprises a 6-bit input/output port and an 8-bit input port with the pin configuration shown in figure 23.7. each pin is controlled by the port g control register (pgcr) in the pfc. port g ptg13 (input/output) ptg12 (input/output) ptg11 (input/output) ptg10 (input/output)/sda (input/output) ptg9 (input/output)/scl (input/output) ptg8 (input/output) ptg7 (input)/an7 (input) ptg6 (input)/an6 (input) ptg5 (input)/an5 (input) ptg4 (input)/an4 (input) ptg3 (input)/an3 (input) ptg2 (input)/an2 (input) ptg1 (input)/an1 (input) ptg0 (input)/an0 (input) figure 23.7 port g 23.7.1 register description port g registers has the following register. ? port g data register (pgdr)
section 23 i/o ports rev. 4.00 sep. 14, 2005 page 857 of 982 rej09b0023-0400 23.7.2 port g data register (pgdr) pgdr a register that includes si x readable/writable and eight readable bits with two reserved bits that store data for pins ptg13 to ptg0. pgdr13 to pgdr8 are initialized to h ' 00 by a power-on reset, but they retain their previous values by a manual reset, in standby mode, or in sleep mode. pgdr7 to pgdr0 are not initialized by a power-on or manual reset, in standby mode, or in sleep mode. (the bit always indicates the status of the pin.) bit bit name initial value r/w description 15, 14 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 13 pg13dt 0 r/w 12 pg12dt 0 r/w 11 pg11dt 0 r/w 10 pg10dt 0 r/w 9 pg9dt 0 r/w 8 pg8dt 0 r/w bits pg13dt to pg8dt correspond to pins ptg13 to ptg8. when the function is general input port, the corresponding pin level is read by reading the port. tables 23.8 and 23.9 show the function of pgdrs 13 to 8. 7 pg7dt 0 r/w 6 pg6dt 0 r/w 5 pg5dt 0 r/w 4 pg4dt 0 r/w 3 pg3dt 0 r/w 2 pg2dt 0 r/w 1 pg1dt 0 r/w 0 pg0dt 0 r/w bits pg7dt to pg0dt corre spond to pins ptg7 to ptg0. the values written to these bits are ignored and does not affect pin state. if these bits are read, the states of the pins are return ed directly instead of the values of these bits. do not read these bits when the a/d converter is used. t able 23.10 shows the function of pgdr. note: * the initial value depends on the st atus of the pin at reading.
section 23 i/o ports rev. 4.00 sep. 14, 2005 page 858 of 982 rej09b0023-0400 table 23.8 port g data register (pgdr) read/write operations (pg13dt to pg11dt, pg8dt) pgnmd2 pgnmd1 pin state read write 0 0 input pin state data is wri tten to pgdr, but does not affect pin state. 1 output pgdr value data is written to pgdr and the value is output from the pin. other than above reserved ? ? (n = 8, 11 to 13) table 23.9 port g data register (pgdr) read/write operations (pg10dt to pg9dt) pgnmd2 pgnmd1 pin state read write 0 0 input pin state data is wri tten to pgdr, but does not affect pin state. 1 output pgdr value data is written to pgdr and the value is output from the pin. 1 0 reserved ? ? 1 other function pin state data is written to pgdr, but does not affect pin state. (n = 9, 10) table 23.10 port g data regi ster (pgdr) read/write operations (pg7dt to pg0dt) pgnmd2 pin state read write input/other function (the a/d converter is used.) prohibited prohibited 0 input/other function (the a/d converter is not used.) pin state ignored (does not affect pin state.) 1 reserved ? ? (n = 0 to 7)
section 23 i/o ports rev. 4.00 sep. 14, 2005 page 859 of 982 rej09b0023-0400 23.7.3 port g internal block diagram pins ptg7 to ptg0 are multiplexed with the a/d converter. (see section 22, pin function controller (pfc).) the statuses of these pins are read only when th e pgdr is read, but are always input to the a/d converter. figure 23.8 shows the internal block diagram of pg7dt to pg0dt. enabled only when the port is read. port data register port a/d figure 23.8 internal bloc k diagram of pg7dt to pg0dt
section 23 i/o ports rev. 4.00 sep. 14, 2005 page 860 of 982 rej09b0023-0400 23.8 port h port h comprises a 15-bit input/output port with the pin configuration shown in figure 23.9. each pin is controlled by the port h control register (phcr) in the pfc. port h pth14 (input/output)/rts2 (input/output) pth13 (input/output)/rxd2 (input) pth12 (input/output)/txd2 (output) pth11 (input/output)/cts2 (input/output) pth10 (input/output)/sck2 (input/output) pth9 (input/output)/rts1 (input/output) pth8 (input/output)/rxd1 (input) pth7 (input/output)/txd1 (output) pth6 (input/output)/cts1 (input/output) pth5 (input/output)/sck1 (input/output) pth4 (input/output)/rts0 (input/output) pth3 (input/output)/rxd0 (input) pth2 (input/output)/txd0 (output) pth1 (input/output)/cts0 (input/output) pth0 (input/output)/sck0 (input/output) figure 23.9 port h 23.8.1 register description port h has the following register. ? port h data register (phdr)
section 23 i/o ports rev. 4.00 sep. 14, 2005 page 861 of 982 rej09b0023-0400 23.8.2 port h data register (phdr) phdr is a 15-bit readable/writable register with one reserved bit that stores data for pins pth14 to pth0. phdr is initialized to h ' 0000 by a power-on reset, but it retains its previous value by a manual reset, in standby mode, or in sleep mode. bit bit name initial value r/w description 15 ? 0 r reserved this bit is always read as 0. the write value should always be 0. 14 ph14dt 0 r/w 13 ph13dt 0 r/w 12 ph12dt 0 r/w 11 ph11dt 0 r/w 10 ph10dt 0 r/w 9 ph9dt 0 r/w 8 ph8dt 0 r/w 7 ph7dt 0 r/w 6 ph6dt 0 r/w 5 ph5dt 0 r/w 4 ph4dt 0 r/w 3 ph3dt 0 r/w 2 ph2dt 0 r/w 1 ph1dt 0 r/w 0 ph0dt 0 r/w bits ph14dt to ph0dt correspond to pins pth14 to pth0. when the pin function is general output port, the value of the corresponding bit in phdr is returned directly by reading the port. when the function is general input port, the corresponding pin level is read by reading the port. table 23. 11 shows the function of phdr.
section 23 i/o ports rev. 4.00 sep. 14, 2005 page 862 of 982 rej09b0023-0400 table 23.11 port h data register (phdr) read/write operations phnmd2 phnmd1 pin state read write 0 0 input pin state data is writt en to phdr, but does not affect pin state. 1 output phdr value data is written to phdr and the value is output from the pin. 1 0 reserved ? ? 1 other functions pin state data is wr itten to phdr, but does not affect pin state. (n = 0 to 14) 23.9 port j port j is a 13-bit input/output port with the pin configuration shown in figure 23.10. each pin is controlled by the port j control register (pjcr) in the pfc. port j ptj12 (input/output)/audsync (output) ptj11 (input/output)/audata3 (output) ptj10 (input/output)/audata2 (output) ptj9 (input/output)/audata1 (output) ptj8 (input/output)/audata0 (output) ptj7 (input/output)/irq7 (input) ptj6 (input/output)/irq6 (input) ptj5 (input/output)/irq5 (input) ptj4 (input/output)/irq4 (input) ptj3 (input/output)/irq3 (input) ptj2 (input/output)/irq2 (input) ptj1 (input/output)/irq1 (input) ptj0 (input/output)/irq0 (input) figure 23.10 port j 23.9.1 register description port j has the following register. ? port j data register (pjdr)
section 23 i/o ports rev. 4.00 sep. 14, 2005 page 863 of 982 rej09b0023-0400 23.9.2 port j data register (pjdr) pjdr is a 13-bit readable/writable register with thre e reserved bits that stores data for pins ptj12 to ptj0. the pjdr is initialized to h ' 0000 by a power-on reset, but it retains its previous value by a manual reset, in standby mode, or in sleep mode. bit bit name initial value r/w description 15 to 13 ? all 0 r reserved these bits are always read as 0. the write value should always be 0. 12 pj12dt 0 r/w 11 pj11dt 0 r/w 10 pj10dt 0 r/w 9 pj9dt 0 r/w 8 pj8dt 0 r/w 7 pj7dt 0 r/w 6 pj6dt 0 r/w 5 pj5dt 0 r/w 4 pj4dt 0 r/w 3 pj3dt 0 r/w 2 pj2dt 0 r/w 1 pj1dt 0 r/w 0 pj0dt 0 r/w bits pj12dt to pj0dt correspond to pins ptj12 to ptj0. when the pin function is general output port, the value of the corresponding bit in pjdr is returned directly by reading the port. when the function is general input port, the corresponding pin level is read by reading the port. table 23. 12 shows the function of pjdr. table 23.12 port j data regist er (pjdr) read/write operations pjnmd2 pjnmd1 pin state read write 0 0 input pin state data is wri tten to pjdr, but does not affect pin state. 1 output pjdr value data is written to pjdr and the value is output from the pin. 1 0 reserved ? ? 1 other functions pin state data is written to pjdr, but does not affect pin state. (n = 0 to 12)
section 23 i/o ports rev. 4.00 sep. 14, 2005 page 864 of 982 rej09b0023-0400
section 24 list of registers rev. 4.00 sep. 14, 2005 page 865 of 982 rej09b0023-0400 section 24 list of registers this section gives information on the on-chip i/o registers and is configured as described below. 1. register addresses (by functional module, in order of the corresponding section numbers) ? descriptions by functional module, in order of the corresponding section numbers entries that consist of - lines are for separation of the functional modules. ? access to reserved addresses which are not described in this list is prohibited. ? when registers consist of 16 or 32 bits, the addresses of the msbs are given. 2. register bits ? bit configurations of the registers are describe d in the same order as the register addresses (by functional module, in order of the corresponding section numbers). ? reserved bits are indicated by?in the bit name. ? no entry in the bit-name column indicates that the whole register is al located as a counter or for holding data. ? when registers consist of 16 or 32 bits, bits are described from the msb side. 3. register states in each operating mode ? register states are described in the same or der as the register addresses (by functional module, in order of the corresponding section numbers). ? for the initial state of each bit, refer to the de scription of the register in the corresponding section. ? the register states described are for the basic operating modes. if there is a specific reset for an on-chip module, refer to the section on that on-chip module.
section 24 list of registers rev. 4.00 sep. 14, 2005 page 866 of 982 rej09b0023-0400 24.1 register addresses (by functional module, in order of the corresponding section numbers) entries under access size indicates numbers of bits. note: access to undefined or reserved addresses is prohibited. since operation or continued operation is not guaranteed when these registers are accessed, do not attempt such access. register name abbreviation bit no. address module access states frequency control register fr qcr 16 h'a415ff80 cpg 16 ? ? ? ? ? ? watchdog timer counter wtcnt 8 h'a415ff84 wdt 16 * 1 watchdog timer control/status re gister wtcsr 8 h'a415ff86 16 * 2 ? ? ? ? ? ? standby control register stbcr 8 h'a415ff82 8 standby control register 2 stbcr2 8 h'a415ff88 power-down modes 8 standby control register 3 stbcr3 8 h'a40a0000 8 standby control register 4 stbcr4 8 h'a40a0004 8 ? ? ? ? ? ? cache control register 1 ccr1 32 h'ffffffec cache 32 cache control register 2 ccr2 32 h'a40000b0 32 ? ? ? ? ? ? interrupt event register 2 intevt2 32 h'a400 0000 32 trapa exception register tra 32 h'ffffffd0 exception handling 32 exception event register expevt 32 h'ffffffd4 32 ? ? ? ? ? ? interrupt priority registers f iprf 16 h'a408 0000 intc 16 interrupt priority registers g iprg 16 h'a408 0002 16 interrupt priority registers h iprh 16 h'a408 0004 16 interrupt priority registers i ipri 16 h'a408 0006 16
section 24 list of registers rev. 4.00 sep. 14, 2005 page 867 of 982 rej09b0023-0400 register name abbreviation bit no. address module access states interrupt mask register 0 imr0 8 h'a408 0040 intc 8 interrupt mask register 1 imr1 8 h'a408 0042 8 interrupt mask register 2 imr2 8 h'a408 0044 8 interrupt mask register 4 imr4 8 h'a408 0048 8 interrupt mask register 5 imr5 8 h'a408 004a 8 interrupt mask register 6 imr6 8 h'a408 004c 8 interrupt mask register 7 imr7 8 h'a408 004e 8 interrupt mask register 8 imr8 8 h'a408 0050 8 interrupt mask register 9 imr9 8 h'a408 0052 8 interrupt mask register 10 imr10 8 h'a408 0054 8 interrupt mask clear register 0 imcr0 8 h'a408 0060 8 interrupt mask clear register 1 imcr1 8 h'a408 0062 8 interrupt mask clear register 2 imcr2 8 h'a408 0064 8 interrupt mask clear register 4 imcr4 8 h'a408 0068 8 interrupt mask clear register 5 imcr5 8 h'a408 006a 8 interrupt mask clear register 6 imcr6 8 h'a408 006c 8 interrupt mask clear register 7 imcr7 8 h'a408 006e 8 interrupt mask clear register 8 imcr8 8 h'a408 0070 8 interrupt mask clear register 9 imcr9 8 h'a408 0072 8 interrupt mask clear register 10 imcr10 8 h'a408 0074 8 interrupt request register 0 irr0 8 h'a414 0004 8 interrupt control register 1 icr1 16 h'a414 0010 16 interrupt control register 3 icr3 16 h'a414 0020 16 interrupt priority registers c iprc 16 h'a414 0016 16 interrupt priority registers d iprd 16 h'a414 0018 16 interrupt priority registers e ipre 16 h'a414 001a 16 interrupt priority registers j iprj 16 h'a414 0030 16 interrupt control register 0 icr0 16 h'a414 fee0 16 interrupt priority registers b iprb 16 h'a414 fee4 16 ? ? ? ? ? ?
section 24 list of registers rev. 4.00 sep. 14, 2005 page 868 of 982 rej09b0023-0400 register name abbreviation bit no. address module access states break data register b bdrb 32 h'a4ffff90 ubc 32 break data mask register b bdmrb 32 h'a4ffff94 32 break control register brcr 32 h'a4ffff98 32 execution times break register betr 16 h'a4ffff9c 16 break address register b barb 32 h'a4ffffa0 32 break address mask register b bamrb 32 h'a4ffffa4 32 break bus cycle register b bbrb 16 h'a4ffffa8 16 branch source register brsr 32 h'a4ffffac 32 break address register a bara 32 h'a4ffffb0 32 break address mask register a bamra 32 h'a4ffffb4 32 break bus cycle register a bbra 16 h'a4ffffb8 16 branch destination register brdr 32 h'a4ffffbc 32 ? ? ? ? ? ? common control register cmncr 32 h'a4fd0000 bsc 32 bus control register for area 0 cs0bcr 32 h'a4fd0004 32 bus control register for area 2 cs2bcr 32 h'a4fd0008 32 bus control register for area 3 cs3bcr 32 h'a4fd000c 32 bus control register for area 4 cs4bcr 32 h'a4fd0010 32 bus control register for area 5a cs5abcr 32 h'a4fd0014 32 bus control register for area 5b cs5bbcr 32 h'a4fd0018 32 bus control register for area 6a cs6abcr 32 h'a4fd001c 32 bus control register for area 6b cs6bbcr 32 h'a4fd0020 32 wait control register for area 0 cs0wcr 32 h'a4fd0024 32 wait control register for area 2 cs2wcr 32 h'a4fd0028 32 wait control register for area 3 cs3wcr 32 h'a4fd002c 32 wait control register for area 4 cs4wcr 32 h'a4fd0030 32 wait control register for area 5a cs5awcr 32 h'a4fd0034 32 wait control register for area 5b cs5bwcr 32 h'a4fd0038 32 wait control register for area 6a cs6awcr 32 h'a4fd003c 32 wait control register for area 6b cs6bwcr 32 h'a4fd0040 32 sdram control register sdcr 32 h'a4fd0044 32
section 24 list of registers rev. 4.00 sep. 14, 2005 page 869 of 982 rej09b0023-0400 register name abbreviation bit no. address module access states refresh timer control/status re gister rtcsr 16 h'a4fd0048 bsc 32 * 3 refresh timer counter rtcnt 16 h'a4fd004c 32 * 3 refresh time constant register rtcor 16 h'a4fd0050 32 * 3 reset wait counter rwtcnt 16 h'a4fd0054 32 * 3 ? ? ? ? ? ? dma source address register_0 sar_0 32 h'a401 0020 dmac 16/32 dma destination address register_0 dar_0 32 h'a401 0024 16/32 dma transfer count register_0 dmatcr_0 32 h'a401 0028 16/32 dma channel control register_0 chcr_0 32 h'a401 002c 8/16/32 dma source address register_1 sar_1 32 h'a401 0030 16/32 dma destination address register_1 dar_1 32 h'a401 0034 16/32 dma transfer count register_1 dmatcr_1 32 h'a401 0038 16/32 dma channel control register _1 chcr_1 32 h'a401 003c 8/16/32 dma source address register_2 sar_2 32 h'a401 0040 16/32 dma destination address register_2 dar_2 32 h'a401 0044 16/32 dma transfer count register_2 dmatcr_2 32 h'a401 0048 16/32 dma channel control register_2 chcr_2 32 h'a401 004c 8/16/32 dma source address register_3 sar_3 32 h'a401 0050 16/32 dma destination address register_3 dar_3 32 h'a401 0054 16/32 dma transfer count register_3 dmatcr_3 32 h'a401 0058 16/32 dma channel control register_3 chcr_3 32 h'a401 005c 8/16/32 dma operation register dmaor 32 h'a401 0060 8/16/32 dma extension resource selector 0 dmars0 16 h'a409 0000 16 dma extension resource selector 1 dmars1 16 h'a409 0004 16 ? ? ? ? ? ? instruction register sdir 16 h'a100 0200 h-udi 16 id register sdidh 16 h'a100 0214 16/32 id register sdidl 16 h'a100 0216 16 ? ? ? ? ? ?
section 24 list of registers rev. 4.00 sep. 14, 2005 page 870 of 982 rej09b0023-0400 register name abbreviation bit no. address module access states i 2 c bus control register 1 iccr1 8 h'a447 0000 iic2 8 i 2 c bus control register 2 iccr2 8 h'a447 0001 8 i 2 c bus mode register icmr 8 h'a447 0002 8 i 2 c bus interrupt enable register icier 8 h'a447 0003 8 i 2 c bus status register icsr 8 h'a447 0004 8 i 2 c bus slave address register sar 8 h'a447 0005 8 i 2 c bus transmit data register icdrt 8 h'a447 0006 8 i 2 c bus receive data register icdrr 8 h'a447 0007 8 nf2cyc register nf2cyc 8 h'a447 0008 8 ? ? ? ? ? ? compare match timer start regist er_0 cmstr_0 16 h'a44a 0000 cmt 16 compare match timer control/ status register_0 cmcsr_0 16 h'a44a 0004 16 compare match counter_0 cmcnt_0 16 h'a44a 0008 16 compare match timer constant regi ster_0 cmcor_0 16 h'a44a 000c 16 compare match timer start register_1 cmstr_1 16 h'a44b 0000 16 compare match timer control/ status register_1 cmcsr_1 16 h'a44b 0004 16 compare match counter_1 cmcnt_1 16 h'a44b 0008 16 compare match timer constant regi ster_1 cmcor_1 16 h'a44b 000c 16 ? ? ? ? ? ? timer control register_3 t cr_3 8 h'a449 0000 mtu 8/16/32 timer control register_4 tcr_4 8 h'a449 0001 8/16/32 timer mode register_3 tmdr_3 8 h'a449 0002 8/16/32 timer mode register_4 tmdr_4 8 h'a449 0003 8/16/32 timer i/o control register h _3 tiorh_3 8 h'a449 0004 8/16/32 timer i/o control register l _3 tiorl_3 8 h'a449 0005 8/16/32 timer i/o control register h _4 tiorh_4 8 h'a449 0006 8/16/32 timer i/o control register l _4 tiorl_4 8 h'a449 0007 8/16/32 timer interrupt enable register_3 tier_3 8 h'a449 0008 8/16/32 timer interrupt enable register_4 tier_4 8 h'a449 0009 8/16/32 timer output master enable register toer 8 h'a449 000a 8/16/32
section 24 list of registers rev. 4.00 sep. 14, 2005 page 871 of 982 rej09b0023-0400 register name abbreviation bit no. address module access states timer output control register tocr 8 h'a449 000b mtu 8/16/32 timer gate control register tgcr 8 h'a449 000d 8 timer counter_3 tcnt_3 16 h'a449 0010 16/32 timer counter_4 tcnt_4 16 h'a449 0012 16/32 timer cycle data register tcdr 16 h'a449 0014 16/32 timer dead time data register tddr 16 h'a449 0016 16/32 timer general register a_3 tgra_3 16 h'a449 0018 16/32 timer general register b_3 tgrb_3 16 h'a449 001a 16/32 timer general register a_4 tgra_4 16 h'a449 001c 16/32 timer general register b_4 tgrb_4 16 h'a449 001e 16/32 timer subcounter tcnts 16 h'a449 0020 16/32 timer cycle buffer register tcbr 16 h'a449 0022 16/32 timer general register c_3 tgrc_3 16 h'a449 0024 16/32 timer general register d_3 tgrd_3 16 h'a449 0026 16/32 timer general register c_4 tgrc_4 16 h'a449 0028 16/32 timer general register d_4 tgrd_4 16 h'a449 002a 16/32 timer status register_3 tsr_3 8 h'a449 002c 8/16 timer status register_4 tsr_4 8 h'a449 002d 8/16 timer start register tstr 8 h'a449 0040 8/16 timer synchro register tsyr 8 h'a449 0041 8/16 timer control register_0 tcr_0 8 h'a449 0060 8/16/32 timer mode register_0 tmdr_0 8 h'a449 0061 8/16/32 timer i/o control register h _0 tiorh_0 8 h'a449 0062 8/16/32 timer i/o control register l _0 tiorl_0 8 h'a449 0063 8/16/32 timer interrupt enable register_0 tier_0 8 h'a449 0064 8/16/32 timer status register_0 tsr_0 8 h'a449 0065 8/16/32 timer counter_0 tcnt_0 16 h'a449 0066 16 timer general register a_0 tgra_0 16 h'a449 0068 16/32 timer general register b_0 tgrb_0 16 h'a449 006a 16/32 timer general register c_0 tgrc_0 16 h'a449 006c 16/32 timer general register d_0 tgrd_0 16 h'a449 006e 16/32
section 24 list of registers rev. 4.00 sep. 14, 2005 page 872 of 982 rej09b0023-0400 register name abbreviation bit no. address module access states timer control register_1 tcr_1 8 h'a449 0080 mtu 8/16 timer mode register_1 tmdr_1 8 h'a449 0081 8/16 timer i/o control register _1 tior_1 8 h'a449 0082 8 timer interrupt enable register_1 tier_1 8 h'a449 0084 8/16/32 timer status register_1 tsr_1 8 h'a449 0085 8/16/32 timer counter_1 tcnt_1 16 h'a449 0086 8/16/32 timer general register a_1 tgra_1 16 h'a449 0088 16/32 timer general register b_1 tgrb_1 16 h'a449 008a 16/32 timer control register_2 tcr_2 8 h'a449 00a0 8/16 timer mode register_2 tmdr_2 8 h'a449 00a1 8/16 timer i/o control register_2 tior_2 8 h'a449 00a2 8 timer interrupt enable register_2 tier_2 8 h'a449 00a4 8/16/32 timer status register_2 tsr_2 8 h'a449 00a5 8/16/32 timer counter_2 tcnt_2 16 h'a449 00a6 16/32 timer general register a_2 tgra_2 16 h'a449 00a8 16/32 timer general register b_2 tgrb_2 16 h'a449 00aa 16/32 input level control/status register 1 icsr1 16 h'a44c 0000 8/16/32 output level control/status register ocsr 16 h'a44c 0002 8/16/32 ? ? ? ? ? ? serial mode register_0 scsmr_0 16 h'a440 0000 scif 16 bit rate register_0 scbrr_0 8 h'a440 0004 8 serial control register_0 scscr_0 16 h'a440 0008 16 transmit fifo data register_0 scftdr_0 8 h'a440 000c 8 serial status register_0 scfsr_0 16 h'a440 0010 16 receive fifo data register_0 scfrdr_0 8 h'a440 0014 8 fifo control register_0 scfcr_0 16 h'a440 0018 16 fifo data count register_0 scfdr_0 16 h'a440 001c 16 serial port register_0 scsptr_0 16 h'a440 0020 16 line status register_0 sclsr_0 16 h'a440 0024 16 serial mode register_1 scsmr_1 16 h'a441 0000 16
section 24 list of registers rev. 4.00 sep. 14, 2005 page 873 of 982 rej09b0023-0400 register name abbreviation bit no. address module access states bit rate register_1 scbr r_1 8 h'a441 0004 scif 8 serial control register_1 scscr_1 16 h'a441 0008 16 transmit fifo data register_1 scftdr_1 8 h'a441 000c 8 serial status register_1 scfsr_1 16 h'a441 0010 16 receive fifo data register_1 scfrdr_1 8 h'a441 0014 8 fifo control register_1 scfcr_1 16 h'a441 0018 16 fifo data count register_1 scfdr_1 16 h'a441 001c 16 serial port register_1 scsptr_1 16 h'a441 0020 16 line status register_1 sclsr_1 16 h'a441 0024 16 serial mode register_2 scsmr_2 16 h'a442 0000 16 bit rate register_2 scbrr_2 8 h'a442 0004 8 serial control register_2 scscr_2 16 h'a442 0008 16 transmit fifo data register_2 scftdr_2 8 h'a442 000c 8 serial status register_2 scfsr_2 16 h'a442 0010 16 receive fifo data register_2 scfrdr_2 8 h'a442 0014 8 fifo control register_2 scfcr_2 16 h'a442 0018 16 fifo data count register_2 scfdr_2 16 h'a442 001c 16 serial port register_2 scsptr_2 16 h'a442 0020 16 line status register_2 sclsr_2 16 h'a442 0024 16 ? ? ? ? ? ? usb interrupt flag register 0 usbifr0 8 h'a448 0000 usb 8 usb interrupt flag register 1 usbifr1 8 h'a448 0001 8 usbep0i data register usbepdr0i 8 h'a448 0002 8 usbep0o data register usbepdr0o 8 h'a448 0003 8 usb trigger register usbtrg 8 h'a448 0004 8 usb fifo clear register usbfclr 8 h'a448 0005 8 usbep0o receive data size register usbepsz0o 8 h'a448 0006 8 usbep0s data register usbepdr0s 8 h'a448 0007 8 usb data status register usbdasts 8 h'a448 0008 8 usb interrupt select register 0 usbisr0 8 h'a448 000a 8 usb endpoint stall register usbepstl 8 h'a448 000b 8 usb interrupt enable register 0 usbier0 8 h'a448 000c 8
section 24 list of registers rev. 4.00 sep. 14, 2005 page 874 of 982 rej09b0023-0400 register name abbreviation bit no. address module access states usb interrupt enable register 1 usbier1 8 h'a448 000d usb 8 usbep1 receive data size register usbepsz1 8 h'a448 000f 8 usb interrupt select register 1 usbisr1 8 h'a448 0010 8 usb dma transfer setting register usbdmar 8 h'a448 0011 8 usbep3 data register usbepdr3 8 h'a448 0012 8 usbep1 data register usbepdr1 8 h'a448 0014 8/32 usbep2 data register usbepdr2 8 h'a448 0018 8/32 usb transceiver control regi ster usbxvercr 8 h'a448 001c 8 usb interrupt flag register 2 usbifr2 8 h'a448 001d 8 usb interrupt enable register 2 usbier2 8 h'a448 001e 8 usb bus power control regist er usbctrl 8 h'a448 001f 8 ? ? ? ? ? ? a/d0 data register a addra0 16 h'a44e 0000 adc 16 a/d0 data register b addrb0 16 h'a44e 0002 16 a/d0 data register c addrc0 16 h'a44e 0004 16 a/d0 data register d addrd0 16 h'a44e 0006 16 a/d1 data register a addra1 16 h'a44e 0008 16 a/d1 data register b addrb1 16 h'a44e 000a 16 a/d1 data register c addrc1 16 h'a44e 000c 16 a/d1 data register d addrd1 16 h'a44e 000e 16 a/d0 control/status register adcsr0 16 h'a44e 0010 16 a/d1 control/status register adcsr1 16 h'a44e 0012 16 a/d0 a/d1 control register adcr 16 h'a44e 0014 16 ? ? ? ? ? ? port a control register pacr 32 h'a443 0000 pfc 8/16/32 port b control register pbcr 32 h'a443 0004 8/16/32 port c control register pccr 32 h'a443 0008 8/16/32 port d control register pdcr 32 h'a443 000c 8/16/32 port e control register pecr 32 h'a443 0010 8/16/32 port f control register pfcr 32 h'a443 0014 8/16/32 port g control register pgcr 32 h'a443 0018 8/16/32 port h control register phcr 32 h'a443 001c 8/16/32
section 24 list of registers rev. 4.00 sep. 14, 2005 page 875 of 982 rej09b0023-0400 register name abbreviation bit no. address module access states port j control register pjcr 32 h'a443 0020 pfc 8/16/32 port e i/o register peior 16 h'a443 0038 8/16 port e mtu r/w enable register pemturwer 16 h'a443 003a 8/16 ? ? ? ? ? ? port a data register padr 16 h'a443 0026 port 8/16 port b data register pbdr 16 h'a443 0028 8/16 port c data register pcdr 16 h'a443 002a 8/16 port d data register pddr 16 h'a443 002c 8/16 port e data register pedr 16 h'a443 002e 8/16 port f data register pfdr 16 h'a443 0030 8/16 port g data register pgdr 16 h'a443 0032 8/16 port h data register phdr 16 h'a443 0034 8/16 port j data register pjdr 16 h'a443 0036 8/16 notes: 1. this register only accepts 16-bit writi ng to prevent incorrect writing. in this case, the upper eight bits of the data must be h ' 5a, otherwise writing cannot be performed. when reading, read from the same address in bytes. 2. this register only accepts 16-bit writing to prevent incorrect writing. in this case, the upper eight bits of the data must be h ' a5, otherwise writing cannot be performed. when reading, read from the same address in bytes. 3. this register only accepts 32-bit writing to prevent incorrect writing. in this case, the upper 16 bits of the data must be h ' a55a, otherwise writi ng cannot be performed. when reading, read from the same address in unit of 32 bits. at this time, the upper 16 bits are read as 0s.
section 24 list of registers rev. 4.00 sep. 14, 2005 page 876 of 982 rej09b0023-0400 24.2 register bits register addresses and bit names of the on-chip peripheral modules are described below. each line covers eight bits, and 16-bit and 32-bit registers are shown as 2 or 4 lines, respectively. register abbreviation bit 31/23/15/7 bit 30/22/14/6 bit 29/21/13/5 bit 28/20/12/4 bit 27/19/11/3 bit 26/18/10/2 bit 25/17/9/1 bit 24/16/8/0 module frqcr ? ? ? ckoen ? ? stc1 stc0 cpg ? ? ifc1 ifc0 ? ? pfc1 pfc0 w t c n t w d t wtcsr tme wt/it rsts wovf iovf cks2 cks1 cks0 stbcr stby ? ? ? ? ? ? ? stbcr2 mstp10 mstp9 mstp8 mstp7 ? mstp5 mstp4 mstp3 stbcr3 hiz ? mstp35 ? mstp33 mstp32 mstp31 mstp30 power- down modes stbcr4 ? mstp46 mstp45 mstp44 mstp43 mstp42 ? ? ccr1 ? ? ? ? ? ? ? ? cache ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? cf wb wt ce ccr2 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? le ? ? ? ? ? ? w3load w3lock ? ? ? ? ? ? w2load w2lock intevt2 ? ? ? ? ? ? ? ? exception ? ? ? ? ? ? ? ? handling ? ? ? ? tra ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? imm imm imm imm imm imm imm imm ? ?
section 24 list of registers rev. 4.00 sep. 14, 2005 page 877 of 982 rej09b0023-0400 register abbreviation bit 31/23/15/7 bit 30/22/14/6 bit 29/21/13/5 bit 28/20/12/4 bit 27/19/11/3 bit 26/18/10/2 bit 25/17/9/1 bit 24/16/8/0 module expevt ? ? ? ? ? ? ? ? exception ? ? ? ? ? ? ? ? handling ? ? ? ? iprf ipr15 ipr14 ipr13 ipr12 ipr11 ipr10 ipr9 ipr8 intc ipr7 ipr6 ipr5 ipr4 ipr3 ipr2 ipr1 ipr0 iprg ipr15 ipr14 ipr13 ipr 12 ipr11 ipr10 ipr9 ipr8 ipr7 ipr6 ipr5 ipr4 ipr3 ipr2 ipr1 ipr0 iprh ipr15 ipr14 ipr13 ipr12 ipr11 ipr10 ipr9 ipr8 ipr7 ipr6 ipr5 ipr4 ipr3 ipr2 ipr1 ipr0 ipri ipr15 ipr14 ipr13 ipr 12 ipr11 ipr10 ipr9 ipr8 ipr7 ipr6 ipr5 ipr4 ipr3 ipr2 ipr1 ipr0 imr0 im7 im6 im5 im 4 im3 im2 im1 im0 imr1 im7 im6 im5 im 4 im3 im2 im1 im0 imr2 im7 im6 im5 im 4 im3 im2 im1 im0 imr4 im7 im6 im5 im 4 im3 im2 im1 im0 imr5 im7 im6 im5 im 4 im3 im2 im1 im0 imr6 im7 im6 im5 im 4 im3 im2 im1 im0 imr7 im7 im6 im5 im 4 im3 im2 im1 im0 imr8 im7 im6 im5 im 4 im3 im2 im1 im0 imr9 im7 im6 im5 im 4 im3 im2 im1 im0 imr10 im7 im6 im5 im4 im3 im 2 im1 im0 imcr0 imc7 imc6 imc5 imc4 imc3 imc2 imc1 imc0 imcr1 imc7 imc6 imc5 imc4 imc3 imc2 imc1 imc0 imcr2 imc7 imc6 imc5 imc4 imc3 imc2 imc1 imc0 imcr4 imc7 imc6 imc5 imc4 imc3 imc2 imc1 imc0 imcr5 imc7 imc6 imc5 imc4 imc3 imc2 imc1 imc0 imcr6 imc7 imc6 imc5 imc4 imc3 imc2 imc1 imc0 imcr7 imc7 imc6 imc5 imc4 imc3 imc2 imc1 imc0 imcr8 imc7 imc6 imc5 imc4 imc3 imc2 imc1 imc0
section 24 list of registers rev. 4.00 sep. 14, 2005 page 878 of 982 rej09b0023-0400 register abbreviation bit 31/23/15/7 bit 30/22/14/6 bit 29/21/13/5 bit 28/20/12/4 bit 27/19/11/3 bit 26/18/10/2 bit 25/17/9/1 bit 24/16/8/0 module imcr9 imc7 imc6 imc5 imc4 imc3 imc2 imc1 imc0 intc imcr10 imc7 imc6 imc5 imc4 imc3 imc2 imc1 imc0 irr0 irq7r irq6r irq5r irq4r irq3r irq2r irq1r irq0r icr1 ? irqe ? ? irq51s irq50s irq41s irq40s irq31s irq30s irq21s irq20s irq11s irq10s irq01s irq00s icr3 ? ? ? ? ? ? ? ? ? ? ? ? irq71s irq70s irq61s irq60s iprc ipr15 ipr14 ipr13 ipr12 ipr11 ipr10 ipr9 ipr8 ipr7 ipr6 ipr5 ipr4 ipr3 ipr2 ipr1 ipr0 iprd ipr15 ipr14 ipr13 ipr12 ipr11 ipr10 ipr9 ipr8 ipr7 ipr6 ipr5 ipr4 ipr3 ipr2 ipr1 ipr0 ipre ipr15 ipr14 ipr13 ipr 12 ipr11 ipr10 ipr9 ipr8 ipr7 ipr6 ipr5 ipr4 ipr3 ipr2 ipr1 ipr0 iprj ipr15 ipr14 ipr13 ipr 12 ipr11 ipr10 ipr9 ipr8 ipr7 ipr6 ipr5 ipr4 ipr3 ipr2 ipr1 ipr0 icr0 nmil ? ? ? ? ? ? nmie ? ? ? ? ? ? ? ? iprb ipr15 ipr14 ipr13 ipr 12 ipr11 ipr10 ipr9 ipr8 ipr7 ipr6 ipr5 ipr4 ipr3 ipr2 ipr1 ipr0 bdrb bdb31 bdb30 bdb29 bdb28 bdb27 bdb26 bdb25 bdb24 ubc bdb23 bdb22 bdb21 bdb20 bdb19 bdb18 bdb17 bdb16 bdb15 bdb14 bdb13 bdb12 bdb11 bdb10 bdb9 bdb8 bdb7 bdb6 bdb5 bdb4 bdb3 bdb2 bdb1 bdb0 bdmrb bdmb31 bdmb30 bdmb29 bdmb28 bdmb27 bdmb26 bdmb25 bdmb24 bdmb23 bdmb22 bdmb21 bdmb20 bd mb19 bdmb18 bdmb17 bdmb16 bdmb15 bdmb14 bdmb13 bdmb12 bdmb11 bdmb10 bdmb9 bdmb8 bdmb7 bdmb6 bdmb5 bdmb4 bdmb3 bdmb2 bdmb1 bdmb0 brcr ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? scmfca scmfcb scmfda scmfdb pcte pcba ? ? dbeb pcbb ? ? seq ? ? etbe
section 24 list of registers rev. 4.00 sep. 14, 2005 page 879 of 982 rej09b0023-0400 register abbreviation bit 31/23/15/7 bit 30/22/14/6 bit 29/21/13/5 bit 28/20/12/4 bit 27/19/11/3 bit 26/18/10/2 bit 25/17/9/1 bit 24/16/8/0 module betr ? ? ? ? bet11 bet10 bet9 bet8 ubc bet7 bet6 bet5 bet4 bet3 bet2 bet1 bet0 barb bab31 bab30 bab29 bab28 bab27 bab26 bab25 bab24 bab23 bab22 bab21 bab20 bab19 bab18 bab17 bab16 bab15 bab14 bab13 bab12 bab11 bab10 bab9 bab8 bab7 bab6 bab5 bab4 bab3 bab2 bab1 bab0 bamrb bamb31 bamb30 bamb29 bamb 28 bamb27 bamb26 bamb25 bamb24 bamb23 bamb22 bamb21 bamb20 bamb19 bamb18 bamb17 bamb16 bamb15 bamb14 bamb13 bamb12 bamb11 bamb10 bamb9 bamb8 bamb7 bamb6 bamb5 bamb4 bamb3 bamb2 bamb1 bamb0 bbrb ? ? ? ? ? ? xye xys cdb1 cdb0 idb1 idb0 rwb1 rwb0 szb1 szb0 brsr svf ? ? ? bsa27 bsa26 bsa25 bsa24 bsa23 bsa22 bsa21 bsa20 bsa19 bsa18 bsa17 bsa16 bsa15 bsa14 bsa13 bsa12 bsa11 bsa10 bsa9 bsa8 bsa7 bsa6 bsa5 bsa4 bsa3 bsa2 bsa1 bsa0 bara baa31 baa30 baa29 baa28 baa27 baa26 baa25 baa24 baa23 baa22 baa21 baa20 baa19 baa18 baa17 baa16 baa15 baa14 baa13 baa12 baa11 baa10 baa9 baa8 baa7 baa6 baa5 baa4 baa3 baa2 baa1 baa0 bamra bama31 bama30 bama29 bama 28 bama27 bama26 bama25 bama24 bama23 bama22 bama21 bama20 bama19 bama18 bama17 bama16 bama15 bama14 bama13 bama12 bama11 bama10 bama9 bama8 bama7 bama6 bama5 bama4 bama3 bama2 bama1 bama0 bbra ? ? ? ? ? ? ? ? cda1 cda0 ida1 ida0 rwa1 rwa0 sza1 sza0 brdr dvf ? ? ? bda27 bda26 bda25 bda24 bda23 bda22 bda21 bda20 bda19 bda18 bda17 bda16 bda15 bda14 bda13 bda12 bda11 bda10 bda9 bda8 bda7 bda6 bda5 bda4 bda3 bda2 bda1 bda0
section 24 list of registers rev. 4.00 sep. 14, 2005 page 880 of 982 rej09b0023-0400 register abbreviation bit 31/23/15/7 bit 30/22/14/6 bit 29/21/13/5 bit 28/20/12/4 bit 27/19/11/3 bit 26/18/10/2 bit 25/17/9/1 bit 24/16/8/0 module cmncr ? ? ? ? ? ? ? ? bsc ? ? ? ? ? ? ? ? waitsel ? ? map block dprty1 dprty0 dmaiw2 dmaiw1 dmaiw0 dmaiwa ? ? ck2drv hizmem hizcnt cs0bcr ? iww2 iww1 iww0 iwrwd2 iwrwd1 iwrwd0 iwrws2 iwrws1 iwrws0 iwrrd2 iwrrd1 iwrrd0 iwrrs2 iwrrs1 iwrrs0 ? type2 type1 type0 ? bsz1 bsz0 ? ? ? ? ? ? ? ? ? cs2bcr ? iww2 iww1 iww0 iwrwd2 iwrwd1 iwrwd0 iwrws2 iwrws1 iwrws0 iwrrd2 iwrrd1 iwrrd0 iwrrs2 iwrrs1 iwrrs0 ? type2 type1 type0 ? bsz1 bsz0 ? ? ? ? ? ? ? ? ? cs3bcr ? iww2 iww1 iww0 iwrwd2 iwrwd1 iwrwd0 iwrws2 iwrws1 iwrws0 iwrrd2 iwrrd1 iwrrd0 iwrrs2 iwrrs1 iwrrs0 ? type2 type1 type0 ? bsz1 bsz0 ? ? ? ? ? ? ? ? ? cs4bcr ? iww2 iww1 iww0 iwrwd2 iwrwd1 iwrwd0 iwrws2 iwrws1 iwrws0 iwrrd2 iwrrd1 iwrrd0 iwrrs2 iwrrs1 iwrrs0 ? type2 type1 type0 ? bsz1 bsz0 ? ? ? ? ? ? ? ? ? cs5abcr ? iww2 iww1 iww0 iwrw d2 iwrwd1 iwrwd0 iwrws2 iwrws1 iwrws0 iwrrd2 iwrrd1 iwrrd0 iwrrs2 iwrrs1 iwrrs0 ? type2 type1 type0 ? bsz1 bsz0 ? ? ? ? ? ? ? ? ? cs5bbcr ? iww2 iww1 iww0 iwrw d2 iwrwd1 iwrwd0 iwrws2 iwrws1 iwrws0 iwrrd2 iwrrd1 iwrrd0 iwrrs2 iwrrs1 iwrrs0 ? type2 type1 type0 ? bsz1 bsz0 ? ? ? ? ? ? ? ? ?
section 24 list of registers rev. 4.00 sep. 14, 2005 page 881 of 982 rej09b0023-0400 register abbreviation bit 31/23/15/7 bit 30/22/14/6 bit 29/21/13/5 bit 28/20/12/4 bit 27/19/11/3 bit 26/18/10/2 bit 25/17/9/1 bit 24/16/8/0 module cs6abcr ? iww2 iww1 iww0 iwrw d2 iwrwd1 iwrwd0 iwrws2 bsc iwrws1 iwrws0 iwrrd2 iwrrd1 iwrrd0 iwrrs2 iwrrs1 iwrrs0 ? type2 type1 type0 ? bsz1 bsz0 ? ? ? ? ? ? ? ? ? cs6bbcr ? iww2 iww1 iww0 iwrw d2 iwrwd1 iwrwd0 iwrws2 iwrws1 iwrws0 iwrrd2 iwrrd1 iwrrd0 iwrrs2 iwrrs1 iwrrs0 ? type2 type1 type0 ? bsz1 bsz0 ? ? ? ? ? ? ? ? ? cs0wcr* 1 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? sw1 sw0 wr3 wr2 wr1 wr0 wm ? ? ? ? hw1 hw0 cs0wcr* 2 ? ? ? ? ? ? ? ? ? ? ? ben ? ? bw1 bw0 ? ? ? ? ? w3 w2 w1 w0 wm ? ? ? ? ? ? cs0wcr* 3 ? ? ? ? ? ? ? ? ? ? ? ? ? ? bw1 bw0 ? ? ? ? ? w3 w2 w1 w0 wm ? ? ? ? ? ? cs2wcr* 1 ? ? ? ? ? ? ? ? ? ? ? bas ? ? ? ? ? ? ? ? ? wr3 wr2 wr1 wr0 wm ? ? ? ? ? ? cs2wcr* 4 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? a2cl1 a2cl0 ? ? ? ? ? ? ?
section 24 list of registers rev. 4.00 sep. 14, 2005 page 882 of 982 rej09b0023-0400 register abbreviation bit 31/23/15/7 bit 30/22/14/6 bit 29/21/13/5 bit 28/20/12/4 bit 27/19/11/3 bit 26/18/10/2 bit 25/17/9/1 bit 24/16/8/0 module cs3wcr* 1 ? ? ? ? ? ? ? ? bsc ? ? ? bas ? ? ? ? ? ? ? ? ? wr3 wr2 wr1 wr0 wm ? ? ? ? ? ? cs3wcr* 4 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? wtrp1 wtrp0 ? wtrcd1 wtrcd0 ? a3cl1 a3cl0 ? ? trwl1 trwl0 ? wtrc1 wtrc0 cs4wcr* 1 ? ? ? ? ? ? ? ? ? ? ? bas ? ww2 ww1 ww0 ? ? ? sw1 sw0 wr3 wr2 wr1 wr0 wm ? ? ? ? hw1 hw0 cs4wcr* 2 ? ? ? ? ? ? ? ? ? ? ? ben ? ? bw1 bw0 ? ? ? sw1 sw0 w3 w2 w1 w0 wm ? ? ? ? hw1 hw0 cs5awcr * 1 ? ? ? ? ? ? ? ? ? ? ? ? ? ww2 ww1 ww0 ? ? ? sw1 sw0 wr3 wr2 wr1 wr0 wm ? ? ? ? hw1 hw0 cs5bwcr * 1 ? ? ? ? ? ? ? ? ? ? szsel mpxw/bas ? ww2 ww1 ww0 ? ? ? sw1 sw0 wr3 wr2 wr1 wr0 wm ? ? ? ? hw1 hw0 cs6awcr * 1 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? sw1 sw0 wr3 wr2 wr1 wr0 wm ? ? ? ? hw1 hw0
section 24 list of registers rev. 4.00 sep. 14, 2005 page 883 of 982 rej09b0023-0400 register abbreviation bit 31/23/15/7 bit 30/22/14/6 bit 29/21/13/5 bit 28/20/12/4 bit 27/19/11/3 bit 26/18/10/2 bit 25/17/9/1 bit 24/16/8/0 module cs6bwcr * 1 ? ? ? ? ? ? ? ? bsc ? ? ? bas ? ? ? ? ? ? ? sw1 sw0 wr3 wr2 wr1 wr0 wm ? ? ? ? hw1 hw0 cs6bwcr * 5 ? ? ? ? ? ? ? ? ? ? mpxaw1 mpxaw0 mpxmd ? bw1 bw0 ? ? ? ? ? w3 w2 w1 w0 wm ? ? ? ? ? ? sdcr ? ? ? ? ? ? ? ? ? ? ? a2row1 a2row0 ? a2col1 a2col0 ? ? deep slow rfsh rmode pdown bactv ? ? ? a3row1 a3row0 ? a3col1 a3col0 rtcsr ? ? ? ? ? ? ? ? cmf ? cks2 cks1 cks0 rrc2 rrc1 rrc0 rtcnt ? ? ? ? ? ? ? ? rtcor ? ? ? ? ? ? ? ? rwtcnt ? ? ? ? ? ? ? ? ? s a r _ 0 d m a c d a r _ 0
section 24 list of registers rev. 4.00 sep. 14, 2005 page 884 of 982 rej09b0023-0400 register abbreviation bit 31/23/15/7 bit 30/22/14/6 bit 29/21/13/5 bit 28/20/12/4 bit 27/19/11/3 bit 26/18/10/2 bit 25/17/9/1 bit 24/16/8/0 module d m a t c r _ 0 d m a c chcr_0 tc ? ? ? ? ? ? ? do tl ? ? ? ? am al dm1 dm0 sm1 sm0 rs3 rs2 rs1 rs0 dl ds tb ts1 ts0 ie te de s a r _ 1 d a r _ 1 d m a t c r _ 1 chcr_1 tc ? ? ? ? ? ? ? do ? ? ? ? ? am al dm1 dm0 sm1 sm0 rs3 rs2 rs1 rs0 dl ds tb ts1 ts0 ie te de s a r _ 2
section 24 list of registers rev. 4.00 sep. 14, 2005 page 885 of 982 rej09b0023-0400 register abbreviation bit 31/23/15/7 bit 30/22/14/6 bit 29/21/13/5 bit 28/20/12/4 bit 27/19/11/3 bit 26/18/10/2 bit 25/17/9/1 bit 24/16/8/0 module d a r _ 2 d m a c d m a t c r _ 2 chcr_2 tc ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? dm1 dm0 sm1 sm0 rs3 rs2 rs1 rs0 ? ? tb ts1 ts0 ie te de s a r _ 3 d a r _ 3 d m a t c r _ 3 chcr_3 tc ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? dm1 dm0 sm1 sm0 rs3 rs2 rs1 rs0 ? ? tb ts1 ts0 ie te de
section 24 list of registers rev. 4.00 sep. 14, 2005 page 886 of 982 rej09b0023-0400 register abbreviation bit 31/23/15/7 bit 30/22/14/6 bit 29/21/13/5 bit 28/20/12/4 bit 27/19/11/3 bit 26/18/10/2 bit 25/17/9/1 bit 24/16/8/0 module dmaor ? ? cms1 cms0 ? ? pr1 pr0 dmac ? ? ? ? ? ae nmif dme ? ? ? ? ? ? ? ? ? ? rc0 rc1 rc2 rc3 ? ? dmars0 c1mid5 c1mid4 c1mid3 c1mid2 c1mid1 c1mid0 c1rid1 c1rid0 c0mid5 c0mid4 c0mid3 c0mid2 c0mid1 c0mid0 c0rid1 c0rid0 dmars1 c3mid5 c3mid4 c3mid3 c3mid2 c3mid1 c3mid0 c3rid1 c3rid0 c2mid5 c2mid4 c2mid3 c2mid2 c2mid1 c2mid0 c2rid1 c2rid0 sdir t17 t16 t15 t14 t13 t12 t11 t10 h-udi ? ? ? ? ? ? ? ? sdidh did31 did30 di d29 did28 did27 di d26 did25 did24 did23 did22 did21 did20 did19 did18 did17 did16 sdidl did15 did14 did13 did12 did11 did10 did9 did8 did7 did6 did5 did4 did3 did2 did1 did0 iccr1 ice rcvd mst trs cks3 cks2 cks1 cks0 iic2 iccr2 bbsy scp sdao sdaop sclo ? iicrst ? icmr mls ? ? ? bcwp bs2 bc1 bc0 icier tie teie rie nakie stie acke ackbr ackbt icsr tdre tend rdrf nackf stop al/ove aas adz sar sva6 sva5 sva4 sva3 sva2 sva1 sva0 fs icdrt icdrr nf2cyc ? ? ? ? ? ? ? nf2cyc cmstr_0 ? ? ? ? ? ? ? ? cmt ? ? ? ? ? ? ? str cmcsr_0 ? ? ? ? ? ? ? ? cmf ? cmr1 cmr0 ? ? cks1 cks0 cmcnt_0 c m c o r _ 0
section 24 list of registers rev. 4.00 sep. 14, 2005 page 887 of 982 rej09b0023-0400 register abbreviation bit 31/23/15/7 bit 30/22/14/6 bit 29/21/13/5 bit 28/20/12/4 bit 27/19/11/3 bit 26/18/10/2 bit 25/17/9/1 bit 24/16/8/0 module cmstr_1 ? ? ? ? ? ? ? ? cmt ? ? ? ? ? ? ? str cmcsr_1 ? ? ? ? ? ? ? ? cmf ? cmr1 cmr0 ? ? cks1 cks0 cmcnt_1 c m c o r _ 1 tcr_3 cclr2 cclr1 cclr0 ckeg1 ckeg0 tpsc2 tpsc1 tpsc0 mtu tcr_4 cclr2 cclr1 cclr0 ckeg 1 ckeg0 tpsc2 tpsc1 tpsc0 tmdr_3 ? ? bfb bfa md3 md2 md1 md0 tmdr_4 ? ? bfb bfa md3 md2 md1 md0 tiorh_3 iob3 iob2 iob1 iob0 ioa3 ioa2 ioa1 ioa0 tiorl_3 iod3 iod2 iod1 iod0 ioc3 ioc2 ioc1 ioc0 tiorh_4 iob3 iob2 iob1 iob0 ioa3 ioa2 ioa1 ioa0 tiorl_4 iod3 iod2 iod1 iod0 ioc3 ioc2 ioc1 ioc0 tier_3 ttge tgfasel ? tciev tgied tgiec tgieb tgiea tier_4 ttge tgfasel ? tciev tgied tgiec tgieb tgiea toer ? ? oe4d oe4c oe3d oe4b oe4a oe3b tocr ? psye ? ? ? ? olsn olsp tgcr ? bdc n p fb wf vf uf t c n t _ 3 t c n t _ 4 t c d r t d d r t g r a _ 3
section 24 list of registers rev. 4.00 sep. 14, 2005 page 888 of 982 rej09b0023-0400 register abbreviation bit 31/23/15/7 bit 30/22/14/6 bit 29/21/13/5 bit 28/20/12/4 bit 27/19/11/3 bit 26/18/10/2 bit 25/17/9/1 bit 24/16/8/0 module t g r b _ 3 m t u t g r a _ 4 t g r b _ 4 t c n t s t c b r t g r c _ 3 t g r d _ 3 t g r c _ 4 t g r d _ 4 tsr_3 tcfd ? ? tcfv tgfd tgfc tgfb tgfa tsr_4 tcfd ? ? tcfv tgfd tgfc tgfb tgfa tstr cst4 cst3 ? ? ? cst2 cst1 cst0 tsyr sync4 sync3 ? ? ? sync2 sync1 sync0 tcr_0 cclr2 cclr1 cclr0 ckeg 1 ckeg0 tpsc2 tpsc1 tpsc0 tmdr_0 ? ? bfb bfa md3 md2 md1 md0 tiorh_0 iob3 iob2 iob1 iob0 ioa3 ioa2 ioa1 ioa0 tiorl_0 iod3 iod2 iod1 iod0 ioc3 ioc2 ioc1 ioc0 tier_0 ttge tgfasel ? tciev tgied tgiec tgieb tgiea tsr_0 ? ? ? tcfv tgfd tgfc tgfb tgfa t c n t _ 0
section 24 list of registers rev. 4.00 sep. 14, 2005 page 889 of 982 rej09b0023-0400 register abbreviation bit 31/23/15/7 bit 30/22/14/6 bit 29/21/13/5 bit 28/20/12/4 bit 27/19/11/3 bit 26/18/10/2 bit 25/17/9/1 bit 24/16/8/0 module t g r a _ 0 m t u t g r b _ 0 t g r c _ 0 t g r d _ 0 tcr_1 cclr2 cclr1 cclr0 ckeg 1 ckeg0 tpsc2 tpsc1 tpsc0 tmdr_1 ? ? ? ? md3 md2 md1 md0 tior_1 iob3 iob2 iob1 iob0 ioa3 ioa2 ioa1 ioa0 tier_1 ttge tgfasel tcieu tciev ? ? tgieb tgiea tsr_1 tcfd ? tcfu tcfv ? ? tgfb tgfa t c n t _ 1 t g r a _ 1 t g r b _ 1 tcr_2 cclr2 cclr1 cclr0 ckeg 1 ckeg0 tpsc2 tpsc1 tpsc0 tmdr_2 ? ? ? ? md3 md2 md1 md0 tior_2 iob3 iob2 iob1 iob0 ioa3 ioa2 ioa1 ioa0 tier_2 ttge tgfasel tcieu tciev ? ? tgieb tgiea tsr_2 tcfd ? tcfu tcfv ? ? tgfb tgfa t c n t _ 2 t g r a _ 2 t g r b _ 2
section 24 list of registers rev. 4.00 sep. 14, 2005 page 890 of 982 rej09b0023-0400 register abbreviation bit 31/23/15/7 bit 30/22/14/6 bit 29/21/13/5 bit 28/20/12/4 bit 27/19/11/3 bit 26/18/10/2 bit 25/17/9/1 bit 24/16/8/0 module icsr1 poe3f poe2f poe1f poe0f ? ? ? pie mtu poe3m1 poe3m0 poe2m1 poe2m0 poe1m1 poe1m0 poe0m1 poe0m0 ocsr osf ? ? ? ? ? oce oie ? ? ? ? ? ? ? ? scsmr_0 ? ? ? ? ? ? ? ? scif c/ a chr pe o/ e stop ? cks1 cks0 s c b r r _ 0 scscr_0 ? ? ? ? ? ? ? ? tie rie te re reie ? cke1 cke0 s c f t d r _ 0 scfsr_0 per3 per2 per1 per0 fer3 fer2 fer1 fer0 er tend tdfe brk fer per rdf dr s c f r d r _ 0 scfcr_0 ? ? ? ? ? rstrg2 rstrg1 rstrg0 rtrg1 rtrg0 ttrg1 ttrg0 mce tfrst rfrst loop scfdr_0 ? ? ? t4 t3 t2 t1 t0 ? ? ? r4 r3 r2 r1 r0 scsptr_0 ? ? ? ? ? ? ? ? rtsio rtsdt ctsio ctsdt sckio sckdt spb2io spb2dt sclsr_0 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? orer scsmr_1 ? ? ? ? ? ? ? ? c/ a chr pe o/ e stop ? cks1 cks0 s c b r r _ 1 scscr_1 ? ? ? ? ? ? ? ? tie rie te re reie ? cke1 cke0 s c f t d r _ 1 scfsr_1 per3 per2 per1 per0 fer3 fer2 fer1 fer0 er tend tdfe brk fer per rdf dr s c f r d r _ 1
section 24 list of registers rev. 4.00 sep. 14, 2005 page 891 of 982 rej09b0023-0400 register abbreviation bit 31/23/15/7 bit 30/22/14/6 bit 29/21/13/5 bit 28/20/12/4 bit 27/19/11/3 bit 26/18/10/2 bit 25/17/9/1 bit 24/16/8/0 module scfcr_1 ? ? ? ? ? rstrg2 rstrg1 rstrg0 scif rtrg1 rtrg0 ttrg1 ttrg0 mce tfrst rfrst loop scfdr_1 ? ? ? t4 t3 t2 t1 t0 ? ? ? r4 r3 r2 r1 r0 scsptr_1 ? ? ? ? ? ? ? ? rtsio rtsdt ctsio ctsdt sckio sckdt spb2io spb2dt sclsr_1 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? orer scsmr_2 ? ? ? ? ? ? ? ? c/ a chr pe o/ e stop ? cks1 cks0 s c b r r _ 2 scscr_2 ? ? ? ? ? ? ? ? tie rie te re reie ? cke1 cke0 s c f t d r _ 2 scfsr_2 per3 per2 per1 per0 fer3 fer2 fer1 fer0 er tend tdfe brk fer per rdf dr s c f r d r _ 2 scfcr2 ? ? ? ? ? rstrg2 rstrg1 rstrg0 rtrg1 rtrg0 ttrg1 ttrg0 mce tfrst rfrst loop scfdr2 ? ? ? t4 t3 t2 t1 t0 ? ? ? r4 r3 r2 r1 r0 scsptr2 ? ? ? ? ? ? ? ? rtsio rtsdt ctsio ctsdt sckio sckdt spb2io spb2dt sclsr2 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? orer usbifr0 brst ep1full ep2tr ep2empt y setupts ep0ots ep0itr ep0its usb usbifr1 ? ? ? ? vbusmn ep3tr ep3ts vbusf usbepdr0i d7 d6 d5 d4 d3 d2 d1 d0 usbepdr0o d7 d6 d5 d4 d3 d2 d1 d0 usbtrg ? ep3pkte ep1rdfn ep2pkte ? ep0srdfn ep0ordfn ep0ipkte usbfclr ? ep3clr ep1clr ep2clr ? ? ep0oclr ep0iclr
section 24 list of registers rev. 4.00 sep. 14, 2005 page 892 of 982 rej09b0023-0400 register abbreviation bit 31/23/15/7 bit 30/22/14/6 bit 29/21/13/5 bit 28/20/12/4 bit 27/19/11/3 bit 26/18/10/2 bit 25/17/9/1 bit 24/16/8/0 module usbepsz0o ? ? ? ? ? ? ? ? usb usbepdr0s d7 d6 d5 d4 d3 d2 d1 d0 usbdasts ? ? ep3de ep2de ? ? ? ep0ide usbisr0 brst ep1full ep2tr ep2empt y setupts ep0ots ep0itr ep0its usbepstl ? ? ? asce ep3stl ep2stl ep1stl ep0stl usbier0 brst ep1full ep2tr ep2empt y setupts ep0ots ep0itr ep0its usbier1 ? ? ? ? ? ep3tr ep3ts vbusf usbepsz1 ? ? ? ? ? ? ? ? usbisr1 ? ? ? ? ? ep3tr ep3ts vbusf usbdmar ? ? ? ? ? ? ep2dmae ep1dmae usbepdr3 d7 d6 d5 d4 d3 d2 d1 d0 usbepdr1 d7 d6 d5 d4 d3 d2 d1 d0 usbepdr2 d7 d6 d5 d4 d3 d2 d1 d0 usbxvercr ? ? ? ? ? ? ? xveroff usbifr2 ? ? ? ? awake susps cfgv setc usbier2 ? ? ? ? ? ? ? setc usbctrl ? ? ? ? ? ? suspend pwmd a d d r a 0 a d c ? ? ? ? ? ? a d d r b 0 ? ? ? ? ? ? a d d r c 0 ? ? ? ? ? ? a d d r d 0 ? ? ? ? ? ? a d d r a 1 ? ? ? ? ? ? a d d r b 1 ? ? ? ? ? ? a d d r c 1 ? ? ? ? ? ?
section 24 list of registers rev. 4.00 sep. 14, 2005 page 893 of 982 rej09b0023-0400 register abbreviation bit 31/23/15/7 bit 30/22/14/6 bit 29/21/13/5 bit 28/20/12/4 bit 27/19/11/3 bit 26/18/10/2 bit 25/17/9/1 bit 24/16/8/0 module addrd1 adc ? ? ? ? ? ? adcsr0 adf adie adst dmasl trge ? ? ? cks1 cks0 multi1 multi0 ? ? ch1 ch0 adcsr1 adf adie adst dmasl trge ? ? ? cks1 cks0 multi1 multi0 ? ? ch1 ch0 adcr dsmp ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? pacr ? ? pa14md2 pa14md1 pa13md2 pa13md1 pa12md2 pa12md1 pfc pa11md2 pa11md1 pa10md2 pa10m d1 pa9md2 pa9md1 pa8md2 pa8md1 pa7md2 pa7md1 pa6md2 pa6md1 pa5md2 pa5md1 pa4md2 pa4md1 pa3md2 pa3md1 pa2md2 pa2md1 pa1md2 pa1md1 pa0md2 pa0md1 pbcr ? ? ? ? ? ? ? ? ? ? ? ? ? ? pb8md2 pb8md1 pb7md2 pb7md1 pb6md2 pb6md1 pb5md2 pb5md1 pb4md2 pb4md1 pb3md2 pb3md1 pb2md2 pb2md1 pb1md2 pb1md1 pb0md2 pb0md1 pccr pc15md2 pc15md1 pc14md2 pc14md1 pc13md2 pc13md1 pc12md2 pc12md1 pc11md2 pc11md1 pc10md2 pc10md1 pc9md2 pc9md1 pc8md2 pc8md1 pc7md2 pc7md1 pc6md2 pc6md1 pc5md2 pc5md1 pc4md2 pc4md1 pc3md2 pc3md1 pc2md2 pc2md1 pc1md2 pc1md1 pc0md2 pc0md1 pdcr pd15md2 pd15md1 pd14md2 pd14md1 pd13md2 pd13md1 pd12md2 pd12md1 pd11md2 pd11md1 pd10md2 pd10md1 pd9md2 pd9md1 pd8md2 pd8md1 pd7md2 pd7md1 pd6md2 pd6md1 pd5md2 pd5md1 pd4md2 pd4md1 pd3md2 pd3md1 pd2md2 pd2md1 pd1md2 pd1md1 pd0md2 pd0md1 pecr pe15md2 pe15md1 pe14md2 pe14md1 pe13md2 pe13md1 pe12md2 pe12md1 pe11md2 pe11md1 pe10md2 pe10m d1 pe9md2 pe9md1 pe8md2 pe8md1 pe7md2 pe7md1 pe6md2 pe6md1 pe5md2 pe5md1 pe4md2 pe4md1 pe3md2 pe3md1 pe2md2 pe2md1 pe1md2 pe1md1 pe0md2 pe0md1
section 24 list of registers rev. 4.00 sep. 14, 2005 page 894 of 982 rej09b0023-0400 register abbreviation bit 31/23/15/7 bit 30/22/14/6 bit 29/21/13/5 bit 28/20/12/4 bit 27/19/11/3 bit 26/18/10/2 bit 25/17/9/1 bit 24/16/8/0 module pfcr pf15md2 pf15md1 pf14md2 pf14md1 pf13md2 pf13md1 pf12md2 pf12md1 pfc pf11md2 pf11md1 pf10md2 pf10md1 pf9md2 pf9md1 pf8md2 pf8md1 pf7md2 pf7md1 pf6md2 pf6md1 pf5md2 pf5md1 pf4md2 pf4md1 pf3md2 pf3md1 pf2md2 pf2md1 pf1md2 pf1md1 pf0md2 pf0md1 pgcr ? ? ? ? pg13md2 pg13md1 pg12md2 pg12md1 pg11md2 pg11md1 pg10md2 pg10md1 pg9md2 pg9md1 pg8md2 pg8md1 pg7md2 pg7md1 pg6md2 pg6md1 pg5md2 pg5md1 pg4md2 pg4md1 pg3md2 pg3md1 pg2md2 pg2md1 pg1md2 pg1md1 pg0md2 pg0md1 phcr ? ? ph14md2 ph14md1 ph13m d2 ph13md1 ph12md2 ph12md1 ph11md2 ph11md1 ph10md2 ph10md1 ph9md2 ph9md1 ph8md2 ph8md1 ph7md2 ph7md1 ph6md2 ph6md1 ph5md2 ph5md1 ph4md2 ph4md1 ph3md2 ph3md1 ph2md2 ph2md1 ph1md2 ph1md1 ph0md2 ph0md1 pjcr ? ? ? ? ? ? pj12md2 pj12md1 pj11md2 pj11md1 pj10md2 pj10md1 pj9md2 pj9md1 pj8md2 pj8md1 pj7md2 pj7md1 pj6md2 pj6md1 pj5md2 pj5md1 pj4md2 pj4md1 pj3md2 pj3md1 pj2md2 pj2md1 pj1md2 pj1md1 pj0md2 pj0md1 peior pe15ior pe14ior pe13ior pe12i or pe11ior pe10ior pe9ior pe8ior pe7ior pe6ior pe5ior pe4ior pe3ior pe2ior pe1ior pe0ior pemturwer ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? mturwe padr ? pa14dt pa13dt pa12dt pa11dt pa10dt pa9dt pa8dt port pa7dt pa6dt pa5dt pa4dt pa3dt pa2dt pa1dt pa0dt pbdr ? ? ? ? ? ? ? pb8dt pb7dt pb6dt pb5dt pb4dt pb3dt pb2dt pb1dt pb0dt pcdr pc15dt pc14dt pc13dt pc12d t pc11dt pc10dt pc9dt pc8dt pc7dt pc6dt pc5dt pc4dt pc3dt pc2dt pc1dt pc0dt pddr pd15dt pd14dt pd13dt pd12d t pd11dt pd10dt pd9dt pd8dt pd7dt pd6dt pd5dt pd4dt pd3dt pd2dt pd1dt pd0dt pedr pe15dt pe14dt pe13dt pe12dt pe11dt pe10dt pe9dt pe8dt pe7dt pe6dt pe5dt pe4dt pe3dt pe2dt pe1dt pe0dt
section 24 list of registers rev. 4.00 sep. 14, 2005 page 895 of 982 rej09b0023-0400 register abbreviation bit 31/23/15/7 bit 30/22/14/6 bit 29/21/13/5 bit 28/20/12/4 bit 27/19/11/3 bit 26/18/10/2 bit 25/17/9/1 bit 24/16/8/0 module pfdr pf15dt pf14dt pf13dt pf12dt pf 11dt pf10dt pf9dt pf8dt port pf7dt pf6dt pf5dt pf4dt pf3dt pf2dt pf1dt pf0dt pgdr ? ? pg13dt pg12dt pg11dt pg10dt pg9dt pg8dt pg7dt pg6dt pg5dt pg4dt pg3dt pg2dt pg1dt pg0dt phdr ? ph14dt ph13dt ph12dt ph 11dt ph10dt ph9dt ph8dt ph7dt ph6dt ph5dt ph4dt ph3dt ph2dt ph1dt ph0dt pjdr ? ? ? pj12dt pj11dt pj10dt pj9dt pj8dt pj7dt pj6dt pj5dt pj4dt pj3dt pj2dt pj1dt pj0dt notes: 1. when the following memory is in us e: normal memory, byte-selection sram, or mpx- io (address/data multiplexed i/o) 2. when burst rom (asynchronous) is in use 3. when burst rom (synchronous) is in use 4. when sdram is in use 5. when burst mpx-io is in use
section 24 list of registers rev. 4.00 sep. 14, 2005 page 896 of 982 rej09b0023-0400 24.3 register states in each operating mode register abbreviation power-on reset manual reset software standby module standby sleep module frqcr initialized * 1 retained retained ? retained cpg wtcnt initialized * 1 retained retained ? retained wdt wtcsr initialized * 1 retained retained ? retained stbcr initialized retained retained ? retained stbcr2 initialized retained retained ? retained power-down modes stbcr3 initialized retained retained ? retained stbcr4 initialized retained retained ? retained ccr1 initialized initialized retained retained retained cache ccr2 initialized initialized retained retained retained intevt2 initialized initializ ed retained retained retained tra initialized initialized retained retained retained exception handling expevt initialized initialized retained retained retained iprf initialized initialized retained ? retained intc iprg initialized initialized retained ? retained iprh initialized initialized retained ? retained ipri initialized initialized retained ? retained imr0 initialized initialized retained ? retained imr1 initialized initialized retained ? retained imr2 initialized initialized retained ? retained imr4 initialized initialized retained ? retained imr5 initialized initialized retained ? retained imr6 initialized initialized retained ? retained imr7 initialized initialized retained ? retained imr8 initialized initialized retained ? retained imr9 initialized initialized retained ? retained imr10 initialized initialized retained ? retained
section 24 list of registers rev. 4.00 sep. 14, 2005 page 897 of 982 rej09b0023-0400 register abbreviation power-on reset manual reset software standby module standby sleep module imcr0 initialized initialized retained ? retained intc imcr1 initialized initialized retained ? retained imcr2 initialized initialized retained ? retained imcr4 initialized initialized retained ? retained imcr5 initialized initialized retained ? retained imcr6 initialized initialized retained ? retained imcr7 initialized initialized retained ? retained imcr8 initialized initialized retained ? retained imcr9 initialized initialized retained ? retained imcr10 initialized initialized retained ? retained irr0 initialized initialized retained ? retained icr1 initialized initialized retained ? retained icr3 initialized initialized retained ? retained iprc initialized initialized retained ? retained iprd initialized initialized retained ? retained ipre initialized initialized retained ? retained iprj initialized initialized retained ? retained icr0 initialized initialized retained ? retained iprb initialized initialized retained ? retained bdrb initialized retained retained retained retained ubc bdmrb initialized retained retained retained retained brcr initialized retained retained retained retained betr initialized retained retained retained retained barb initialized retained retained retained retained bamrb initialized retained retained retained retained bbrb initialized retained retained retained retained brsr undefined* 2 retained retained retained retained bara initialized retained retained retained retained bamra initialized retained retained retained retained
section 24 list of registers rev. 4.00 sep. 14, 2005 page 898 of 982 rej09b0023-0400 register abbreviation power-on reset manual reset software standby module standby sleep module bbra initialized retained retained retained retained ubc brdr undefined * 2 retained retained retained retained cmncr initialized retained retained ? retained bsc cs0bcr initialized retained retained ? retained cs2bcr initialized retained retained ? retained cs3bcr initialized retained retained ? retained cs4bcr initialized retained retained ? retained cs5abcr initialized retained retained ? retained cs5bbcr initialized retained retained ? retained cs6abcr initialized retained retained ? retained cs6bbcr initialized retained retained ? retained cs0wcr initialized retained retained ? retained cs2wcr initialized retained retained ? retained cs3wcr initialized retained retained ? retained cs4wcr initialized retained retained ? retained cs5awcr initialized retained retained ? retained cs5bwcr initialized retained retained ? retained cs6awcr initialized retained retained ? retained cs6bwcr initialized retained retained ? retained sdcr initialized retained retained ? retained rtcsr initialized retained retained ? retained rtcnt initialized retained retained ? retained rtcor initialized retained retained ? retained rwtcnt initialized retained retained ? retained sar_0 undefined undefined retained retained retained dmac dar_0 undefined undefined retained retained retained dmatcr_0 undefined undefined retained retained retained chcr_0 initialized initialized retained retained retained sar_1 undefined undefined retained retained retained
section 24 list of registers rev. 4.00 sep. 14, 2005 page 899 of 982 rej09b0023-0400 register abbreviation power-on reset manual reset software standby module standby sleep module dar_1 undefined undefined retained retained retained dmac dmatcr_1 undefined undefined retained retained retained chcr_1 initialized initialized retained retained retained sar_2 undefined undefined retained retained retained dar_2 undefined undefined retained retained retained dmatcr_2 undefined undefined retained retained retained chcr_2 initialized initialized retained retained retained sar_3 undefined undefined retained retained retained dar_3 undefined undefined retained retained retained dmatcr_3 undefined undefined retained retained retained chcr_3 initialized initialized retained retained retained dmaor initialized initialized retained retained retained dmars0 initialized initialized retained retained retained dmars1 initialized initialized retained retained retained sdir initialized * 4 retained retained retained retained h-udi sdidh initialized retained retained retained retained sdidl initialized retained retained retained retained iccr1 initialized retained retained retained retained iic2 iccr2 initialized retained retained retained retained icmr initialized retained retained retained retained icier initialized retained retained retained retained icsr initialized retained retained retained retained sar initialized retained retained retained retained icdrt undefined retained retained retained retained icdrr undefined retained retained retained retained nf2cyc initialized retained retained retained retained cmstr_0 initialized retained retained retained retained cmt cmcsr_0 initialized retained retained retained retained cmcnt_0 initialized retained retained retained retained
section 24 list of registers rev. 4.00 sep. 14, 2005 page 900 of 982 rej09b0023-0400 register abbreviation power-on reset manual reset software standby module standby sleep module cmcor_0 initialized retained retained retained retained cmt cmstr_1 initialized retained retained retained retained cmcsr_1 initialized retained retained retained retained cmcnt_1 initialized retained retained retained retained cmcor_1 initialized retained retained retained retained tcr_3 initialized retained init ialized initialized retained mtu tcr_4 initialized retained init ialized initialized retained tmdr_3 initialized retained init ialized initialized retained tmdr_4 initialized retained init ialized initialized retained tiorh_3 initialized retained in itialized initialized retained tiorl_3 initialized retained initialized initialized retained tiorh_4 initialized retained in itialized initialized retained tiorl_4 initialized retained initialized initialized retained tier_3 initialized retained initialized initialized retained tier_4 initialized retained initialized initialized retained toer initialized retained initialized initialized retained tocr initialized retained initialized initialized retained tgcr initialized retained initialized initialized retained tcnt_3 initialized retained init ialized initialized retained tcnt_4 initialized retained init ialized initialized retained tcdr initialized retained init ialized initialized retained tddr initialized retained init ialized initialized retained tgra_3 initialized retained initialized initialized retained tgrb_3 initialized retained initialized initialized retained tgra_4 initialized retained initialized initialized retained tgrb_4 initialized retained initialized initialized retained tcnts initialized retained init ialized initialized retained tcbr initialized retained init ialized initialized retained tgrc_3 initialized retained initialized initialized retained
section 24 list of registers rev. 4.00 sep. 14, 2005 page 901 of 982 rej09b0023-0400 register abbreviation power-on reset manual reset software standby module standby sleep module tgrd_3 initialized retained initialized initialized retained mtu tgrc_4 initialized retained initialized initialized retained tgrd_4 initialized retained initialized initialized retained tsr_3 initialized retained initialized initialized retained tsr_4 initialized retained initialized initialized retained tstr initialized retained initialized initialized retained tsyr initialized retained init ialized initialized retained tcr_0 initialized retained init ialized initialized retained tmdr_0 initialized retained init ialized initialized retained tiorh_0 initialized retained initialized initialized retained tiorl_0 initialized retained initialized initialized retained tier_0 initialized retained initialized initialized retained tsr_0 initialized retained initialized initialized retained tcnt_0 initialized retained init ialized initialized retained tgra_0 initialized retained initialized initialized retained tgrb_0 initialized retained initialized initialized retained tgrc_0 initialized retained initialized initialized retained tgrd_0 initialized retained initialized initialized retained tcr_1 initialized retained init ialized initialized retained tmdr_1 initialized retained init ialized initialized retained tior_1 initialized retained initialized initialized retained tier_1 initialized retained initialized initialized retained tsr_1 initialized retained initialized initialized retained tcnt_1 initialized retained init ialized initialized retained tgra_1 initialized retained initialized initialized retained tgrb_1 initialized retained initialized initialized retained tcr_2 initialized retained init ialized initialized retained tmdr_2 initialized retained init ialized initialized retained tior_2 initialized retained initialized initialized retained
section 24 list of registers rev. 4.00 sep. 14, 2005 page 902 of 982 rej09b0023-0400 register abbreviation power-on reset manual reset software standby module standby sleep module tier_2 initialized retained init ialized initialized retained mtu tsr_2 initialized retained initialized initialized retained tcnt_2 initialized retained init ialized initialized retained tgra_2 initialized retained initialized initialized retained tgrb_2 initialized retained initialized initialized retained icsr1 initialized retained retained retained retained ocsr initialized retained retained retained retained scsmr_0 initialized retained re tained retained retained scif scbrr_0 initialized retained retained retained retained scscr_0 initialized retained retained retained retained scftdr_0 undefined retained retained retained retained scfsr_0 initialized retained retained retained retained scfrdr_0 undefined retained retained retained retained scfcr_0 initialized retained retained retained retained scfdr_0 initialized retained retained retained retained scsptr_0 initialized retained retained retained retained sclsr_0 initialized retained retained retained retained scsmr_1 initialized retained retained retained retained scbrr_1 initialized retained retained retained retained scscr_1 initialized retained retained retained retained scftdr_1 undefined retained retained retained retained scfsr_1 initialized retained retained retained retained scfrdr_1 undefined retained retained retained retained scfcr_1 initialized retained retained retained retained scfdr_1 initialized retained retained retained retained scsptr_1 initialized retained retained retained retained sclsr_1 initialized retained retained retained retained scsmr_2 initialized retained retained retained retained scbrr_2 initialized retained retained retained retained
section 24 list of registers rev. 4.00 sep. 14, 2005 page 903 of 982 rej09b0023-0400 register abbreviation power-on reset manual reset software standby module standby sleep module scscr_2 initialized retained re tained retained retained scif scftdr_2 undefined retained retained retained retained scfsr_2 initialized retained retained retained retained scfrdr_2 undefined retained retained retained retained scfcr_2 initialized retained retained retained retained scfdr_2 initialized retained retained retained retained scsptr_2 initialized retained retained retained retained sclsr_2 initialized retained retained retained retained usbifr0 initialized retained retained retained retained usb usbifr1 initialized retained retained retained retained usbepdr0i undefined retained retained retained retained usbepdr0o undefined retained retained retained retained usbtrg initialized retained retained retained retained usbfclr initialized retained retained retained retained usbepsz0o initialized retained retained retained retained usbepdr0s undefined retained retained retained retained usbdasts initialized retained retained retained retained usbisr0 initialized retained retained retained retained usbepstl initialized retained retained retained retained usbier0 initialized retained retained retained retained usbier1 initialized retained retained retained retained usbepsz1 initialized retained retained retained retained usbisr1 initialized retained retained retained retained usbdmar initialized retained retained retained retained usbepdr3 undefined retained retained retained retained usbepdr1 undefined retained retained retained retained usbepdr2 undefined retained retained retained retained usbxvercr initialized retained retained retained retained usbifr2 initialized retained retained retained retained
section 24 list of registers rev. 4.00 sep. 14, 2005 page 904 of 982 rej09b0023-0400 register abbreviation power-on reset manual reset software standby module standby sleep module usbier2 initialized retained retained retained retained usb usbctrl initialized retained retained retained retained addra0 initialized retained initialized initialized retained adc addrb0 initialized retained in itialized initialized retained addrc0 initialized retained in itialized initialized retained addrd0 initialized retained in itialized initialized retained addra1 initialized retained in itialized initialized retained addrb1 initialized retained in itialized initialized retained addrc1 initialized retained in itialized initialized retained addrd1 initialized retained in itialized initialized retained adcsr0 initialized retained initialized initialized retained adcsr1 initialized retained initialized initialized retained adcr initialized retained init ialized initialized retained pacr initialized retained retained ? retained pfc pbcr initialized retained retained ? retained pccr initialized retained retained ? retained pdcr initialized retained retained ? retained pecr initialized retained retained ? retained pfcr initialized retained retained ? retained pgcr initialized retained retained ? retained phcr initialized retained retained ? retained pjcr initialized retained retained ? retained peior initialized retained retained ? retained pemturwer initialized retained retained ? retained padr initialized retained retained ? retained port pbdr initialized retained retained ? retained pcdr initialized retained retained ? retained pddr initialized retained retained ? retained pedr initialized retained retained ? retained
section 24 list of registers rev. 4.00 sep. 14, 2005 page 905 of 982 rej09b0023-0400 register abbreviation power-on reset manual reset software standby module standby sleep module pfdr initialized retained retained ? retained port pgdr initialized * 3 retained retained ? retained phdr initialized retained retained ? retained pjdr initialized retained retained ? retained notes: 1. not initialized by a power-on reset. 2. some bits are initialized. 3. some bits are not initialized. 4. initialized by trst assertion or when the tap controller is in the test-logic-reset state.
section 24 list of registers rev. 4.00 sep. 14, 2005 page 906 of 982 rej09b0023-0400
section 25 electric al characteristics rev. 4.00 sep. 14, 2005 page 907 of 982 rej09b0023-0400 section 25 electrical characteristics the specifications shown in this section are preliminary. after the characteristics have been evaluated, the specifications may be changed without notice. 25.1 absolute maximum ratings table 25.1 lists the absolute maximum ratings. table 25.1 absolute maximum ratings item symbol value unit power supply voltage (i/o) v cc q ? 0.3 to 3.8 v power supply voltage (internal) v cc v cc (pll1) v cc (pll2) ? 0.3 to 2.1 v input voltage (other than ports g7 to g0) v in ? 0.3 to v cc q + 0.3 v input voltage (ports g7 to g0) v in ? 0.3 to av cc (a/d) + 0.3 v analog power supply voltage (a/d) av cc (a/d) ? 0.3 to 3.8 v analog input voltage (a/d) v an ? 0.3 to av cc (a/d) + 0.3 v operating temperature t opr ? 40 to + 85 c storage temperature t stg ? 55 to + 125 c caution: permanent damage to the lsi may resu lt if absolute maximum ratings are exceeded.
section 25 electric al characteristics rev. 4.00 sep. 14, 2005 page 908 of 982 rej09b0023-0400 25.1.1 power-on sequence supply the power so that vccq (3.3-v system) and vcc (1 .8-v system) are supplied simultaneously or vcc is supplied after vccq is supplied. recommended values for the power-on procedure are shown below. v cc q (min.) voltage v cc q: 3.3 v-system power supply v cc : 1.8 v-system power supply v cc (min.) voltage t pwu t unc gnd v cc /2 level voltage the time at which vccq reaches v cc q (min.) the time at which vcc reaches v cc (min.) unsettling opration normal operation operation stopped clock starts oscillation oscillation settling time (10 ms) power-on reset released and then normal operation started t pwd figure 25.1 power-on sequence
section 25 electric al characteristics rev. 4.00 sep. 14, 2005 page 909 of 982 rej09b0023-0400 table 25.2 recommended values for power-on/off sequence item symbol max. permissible value unit time lag between vccq and vcc when turning on tpwu 1 ms time lag between vccq and vcc when turning off tpwd 1 ms unsettling operation time tunc 100 ms notes: 1. the figures shown above are recommended values, so they represent guidelines rather than strict requirements. 2. the system design must, howev er, ensure that the undefined st ates of internal circuits and pin states do not cause erroneous system operation. 3. the negative values in the maximum permissible value column indicate the allowed difference in the time the voltages supplied as vccq and vcc take to rise. therefore, these figures do not allow the power supply in the reverse sequence: vcc then vccq. 4. when vcc (1.8-v power) rises more quickly than vccq (3.3-v power), the figure in the maximum permissible value column is a negative value. 5. the time over which the internal state is undefined means time over which the first supplying of power is in a transient state. 6. the pin states become defined when v ccq (min.) is reached. the power-on reset (resetp ) is accepted after vcc reaches vcc (min.) and after the clock oscillation settling time elapsed. 7. ensure that the period over which the inte rnal state is undefined is less than or equal to 100 ms.
section 25 electric al characteristics rev. 4.00 sep. 14, 2005 page 910 of 982 rej09b0023-0400 25.2 dc characteristics tables 25.3 and 25.4 list dc characteristics. table 25.3 dc characteristics (1) [common items] conditions: ta = ? 40c to + 85c item symbol min. typ. max. unit test conditions current consumption * 1 normal operation i cc * 2 ? 300 400 ma v cc = 1.8 v i = 100 mhz p = 33 mhz i cc q * 3 ? 10 20 ma v cc q = 3.3 v b = 50 mhz standby mode i stby * 2 ? 200 1000 a i stby q * 3 ? 5 20 a sleep mode i sleep * 2 ? 50 110 ma ta = 25 c v cc q = 3.3 v v cc = 1.8 v b = 50 mhz p = 33 mhz input leakage current all input pins |i in | ? ? 1.0 a v in = 0.5 to v cc q ? 0.5 v three-state leakage current all input/output pins, all output pins (except for pins with weak keeper) (off state) |i sti | ? ? 1.0 a vin = 0.5 to v cc q ? 0.5 v input capacitance all pins c in ? ? 20 pf analog power supply voltage (a/d) av cc (ad) 3.0 3.3 3.6 v during a/d conversion ? 2 5 ma analog power supply current (a/d) idle ai cc (ad) ? 600 1000 a caution: when the a/d conver ter is not in use, the av cc and av ss pins should not be open. note: 1. current consumption values ar e when all output pins are unloaded. 2. i cc i sleep and i stby , respectively, represents the total currents consumed in each vcc, v cc (pll1) and vcc (pll2) 3. i cc q and i stby q, respectively, represents the total currents consumed in each v cc q and av cc .
section 25 electric al characteristics rev. 4.00 sep. 14, 2005 page 911 of 982 rej09b0023-0400 table 25.3 dc characteristics (2) [except for i 2 c- and usb-related pins] conditions: v cc = v cc (pll1, pll2) = 1.8 v 5%, v cc q = 3.0 v to 3.6 v, av cc = 3.0 v to 3.6 v, v ss = v ss (pll1, pll2) = av ss = 0 v, ta = ? 40c to + 85c item symbol min. typ. max. unit test conditions v cc q 3.0 3.3 3.6 power supply v cc v cc (pll1) v cc (pll2) 1.71 1.8 1.89 v input high voltage resetp , resetm , nmi , md3, md2 md0, asemd0, trst v cc q 0.9 ? v cc q + 0.3 extal, ckio v cc q ? 0.3 ? v cc q + 0.3 ports g7 to g0 2.3 ? v cc q + 0.3 input pins other than above (excluding schmitt pins) v ih 2.3 ? v cc q + 0.3 v input low voltage resetp , tck, resetm, nmi, md3, md2 md0, asemd0, trst ? 0.3 ? v cc q 0.1 extal, ckio, ? 0.3 ? v cc q 0.2 ports g7 to g0 ? 0.3 ? v cc q 0.2 input pins other than above (excluding schmitt pins) v il ? 0.3 ? v cc q 0.2 v
section 25 electric al characteristics rev. 4.00 sep. 14, 2005 page 912 of 982 rej09b0023-0400 item symbol min. typ. max. unit test conditions v t + v cc q 0.9 ? ? v v t ? ? ? v cc q 0.2 v schmitt trigger input characteristics tioc0a to tioc0d, tioc1a, tioc1b, tioc2a, tioc2b, tioc3a to tioc3d, tioc4a to tioc4d, tclka to tclkd, sck0 to sck2, rxd0 to rxd2, cts0 to cts2 , irq7 to irq0 v t + ? v t ? v cc q 0.05 ? ? v 2.4 ? ? i oh = ?200 a output high voltage all output pins * v oh 2.0 ? ? v i oh = ?2 ma pe0 to pe4, pe6 ? ? 1.5 i ol = 15 ma output low voltage all pins except for above pins, scl, sda * v ol ? ? 0.4 v i ol = 2.0 ma ram standby voltage v ram 1.0 ? ? v measured by vcc (= pll1, pll2) as parameter note: * the scl and sda pins (open-drain pins) when the port functions are selected as the general inputs or outputs, however, the outputs of these pins show the usual v oh /v ol and v ih /v il characteristics.
section 25 electric al characteristics rev. 4.00 sep. 14, 2005 page 913 of 982 rej09b0023-0400 table 25.3 dc characteristics (3) [i 2 c-related pins * ] conditions: v cc q = 3.0 v to 3.6 v, v cc = 1.8 v 5%, v ss q = v ss = 0 v, ta = ? 40c to + 85c item symbol min. typ. max. unit test conditions power supply v cc q 3.0 3.3 3.6 v input high voltage v ih v cc q 0.7 ? v cc q + 0.3 v input low voltage v il ? 0.3 ? v cc q 0.3 v schmitt trigger input characteristics v ih ? v il v cc q 0.05 ? ? v output low voltage v ol 0 ? 0.4 v i ol = 3.0 ma note: * the scl and sda pins (open-drain pins) when the port functions are selected as t he general inputs or out puts, however, these pins have the usual v oh /v ol and v ih /v il characteristics. table 25.3 dc characteristics (4) [usb-related pins * ] conditions: ta = ? 40c to + 85c item symbol min. typ. max. unit test conditions power supply v cc q 3.0 3.3 3.6 v input high voltage v ih 2.3 ? v cc q + 0.3 v input low voltage v il ? 0.3 ? v cc q 0.2 v input high voltage (uclk) v ih (uclk) v cc q ? 0.3 ? v cc q + 0.3 v input low voltage (uclk) v il (uclk) ? 0.3 ? v cc q 0.2 v 2.4 ? ? v cc q = 3.0 v, i oh = ?200 a output high voltage v oh 2.0 ? ? v v cc q = 3.0 v, i oh = ?2.0 ma output low voltage v ol ? ? 0.4 v v cc q = 3.6 v, i ol = 2.0 ma note: * the xvdata, dpls, dmns, txdpls, txdmns, txenl, vbus, suspnd, and uclk pins
section 25 electric al characteristics rev. 4.00 sep. 14, 2005 page 914 of 982 rej09b0023-0400 table 25.3 dc characteristics (5) [usb transceiver-related pins * ] conditions: ta = ? 40c to + 85c item symbol min. typ. max. unit test conditions differential input sensitivity v di 0.2 ? ? v ? (dp) ? (dm) ? differential common mode range v cm 0.8 ? 2.5 v single ended receiver threshold voltage v se 0.8 ? 2.0 v output high voltage v oh 2.8 ? v cc q v output low voltage v ol ? ? 0.3 v tri-state leak current i lo ? 10 ? 10 a 0 v < v in < 3.3 v note: * the dp and dm pins table 25.4 permissible output currents conditions: v cc = 1.8 v 5%, v cc q = 3.0 v to 3.6 v, av cc = 3.0 v to 3.6 v, v ref = pllv ss = av ss = 0 v, ta = ? 40c to + 85c item symbol min. typ. max. unit scl, sda 10 pe0 to pe4, pe6 15 permissible output low current (per pin) other than above i ol ? ? 2 ma permissible output low current (total) i ol ? ? 120 ma permissible output high current (per pin) ? i oh ? ? 2 ma permissible output high current (total) ? i oh ? ? 40 ma caution: to protect the lsi's re liability, do not exceed the output current values in table 25.4.
section 25 electric al characteristics rev. 4.00 sep. 14, 2005 page 915 of 982 rej09b0023-0400 25.3 ac characteristics signals input to this lsi are basically handled as signals in synchronization with a clock. the setup and hold times for input pins must be followed. table 25.5 maximum operating frequency conditions: v cc q = 3.0 v to 3.6 v, v cc = 1.8 v 5%, av cc = 3.0 v to 3.6 v, ta = ? 40c to + 85c item symbol min. typ. max. unit remarks cpu, cache (i ) 20 ? 100 external buss (b ) 20 ? 50 operating frequency peripheral module (p ) f 5 ? 33 mhz
section 25 electric al characteristics rev. 4.00 sep. 14, 2005 page 916 of 982 rej09b0023-0400 25.3.1 clock timing table 25.6 clock timing conditions: v cc q = 3.0 v to 3.6 v, v cc = 1.8 v 5%, av cc = 3.0 v to 3.6 v, v ss q = v ss = av ss = 0 v, ta = ? 40c to + 85c item symbol min. max. unit figure(s) extal clock input frequency f ex 10 25 mhz extal clock input cycle time t excyc 40 100 ns extal clock input pulse low width t exl 7 ? ns extal clock input pulse high width t exh 7 ? ns extal clock input rising time t exr ? 4 ns extal clock falling time t exf ? 4 ns 25.2 ckio clock input frequency f ck 20 50 mhz ckio clock input cycle time t ckcyc 20 50 ns ckio clock input low pulse width t ckil 7 ? ns ckio clock input high pulse width t ckih 7 ? ns ckio clock input rising time t ckir ? 3 ns ckio clock input falling time t ckif ? 3 ns 25.3 ckio, ckio2 clock output frequency f op 20 50 mhz ckio, ckio2 clock output cycle time t cyc 20 50 ns ckio, ckio2 clock output pulse low width t ckol 7 ? ns ckio, ckio2 clock output pulse high width t ckoh 7 ? ns ckio, ckio2 clock output rising time t ckor ? 5 ns ckio, ckio2 clock falling time t ckof ? 5 ns 25.4 oscillation settling time (after power-on reset) t osc1 10 ? ms 25.5 phase difference between ckio and ckio2 t phckio2 ? 3 ns 25.6 oscillation settling time 1 (after standby mode) t osc2 10 ? ms 25.7 oscillation settling time 2 (after standby mode) t osc3 10 ? ms 25.8
section 25 electric al characteristics rev. 4.00 sep. 14, 2005 page 917 of 982 rej09b0023-0400 t exh t exf t exr t exl t excyc v ih v ih v ih 1/2 v cc 1/2 v cc v il v il extal* (input) note: * when the clock is input on the extal pin. figure 25.2 extal clock input timing t ckih t ckif t ckir t ckil t ckicyc v ih v ih v ih 1/2 v cc q 1/2 v cc q v il v il ckio (input) figure 25.3 ckio clock input timing t cyc t ckol t ckoh v ih 1/2v cc ckio, ckio2 (output) 1/2v cc t ckor t ckof v oh v ol v ol v oh figure 25.4 ckio and ckio2 clock input timing
section 25 electric al characteristics rev. 4.00 sep. 14, 2005 page 918 of 982 rej09b0023-0400 v cc min t resp/mw t resp/ms t osc1 v cc resetp resetm ckio, internal clock note: oscillation settling time when the internal oscillator is used. oscillation settling time figure 25.5 oscillation settling timing (power-on) ckio ckio2 t phckio2 figure 25.6 phase difference between ckio and ckio2 ckio, internal clock oscillation settling time standby period t osc2 t resp/mw resetp resetm note: oscillation settling time when the internal oscillator is used. figure 25.7 oscillation settling timing (standby mode canceled by reset)
section 25 electric al characteristics rev. 4.00 sep. 14, 2005 page 919 of 982 rej09b0023-0400 ckio, internal clock oscillation settling time standby period note: oscillation settling time when the internal oscillator is used. t osc3 nmi, irq figure 25.8 oscillation settling ti ming (standby mode canceled by nmi or irq )
section 25 electric al characteristics rev. 4.00 sep. 14, 2005 page 920 of 982 rej09b0023-0400 25.3.2 control signal timing table 25.7 control signal timing conditions: v cc q = 3.0 v to 3.6 v, v cc = 1.8 v 5%, av cc = 2.7 v to 3.6 v, v ss q = v ss = av ss = 0 v, ta = ? 40c to + 85c b = 50 mhz * 2 item symbol min. max. unit figure(s) resetp pulse width t respw 20* 2 ? bcyc * 4 resetp setup time * 1 t resps 22 ? ns 25.5, 25.6, 25.9, and 25.10 resetp hold time t resph 2 ? ns resetm pulse width t resmw 12* 3 ? bcyc * 4 resetm setup time t resms 22 ? ns resetm hold time t resmh 12 ? ns breq setup time t breqs 1/2t cyc + 10 ? ns 25.11 breq hold time t breqh 1/2t cyc + 10 ? ns nmi setup time * 1 t nmis 30 ? ns 25.10 nm i hold time t nmih 30 ? ns irq7 to irq0 setup time * 1 t irqs 30 ? ns irq7 to irq0 hold time t irqh 30 ? ns back delay time t backd ? 1/2t cyc + 13 ns 25.11, 25.12 status1, status0 delay time t std ? 100 ns bus tri-state delay time 1 t boff1 0 100 ns bus tri-state delay time 2 t boff2 0 100 ns bus buffer on time 1 t bon1 0 30 ns buss buffer on time 2 t bon2 0 30 ns notes: 1. the resetp, nmi and irq7 to irq0 signals are asynchronous signals. when the setup time is satisfied, change of signal leve l is detected at the risi ng edge of the clock. if not, the detection is delayed until the rising edge of the clock. 2. in standby mode, t resp = t osc2 (10 ms). when multiplier of the clock is changed, t repw = t pll1 (100 s) 3. in standby mode, t resp = t osc2 (10 ms). when multiplier of the clock is changed, resetm must be held low until signals status0 and st atus1 indicate the reset state (hh). 4. bcyc indicates external cl ock cycle time. (b clock cycle)
section 25 electric al characteristics rev. 4.00 sep. 14, 2005 page 921 of 982 rej09b0023-0400 ckio t resps/ms t resps/ms resetp resetm t respw/mw figure 25.9 reset input timing ckio resetp resetm t resph/mh t resps/ms v ih v il nmi t nmih t nmis v ih v il i rq7 to irq0 t irqh t irqs v ih v il figure 25.10 int errupt input timing
section 25 electric al characteristics rev. 4.00 sep. 14, 2005 page 922 of 982 rej09b0023-0400 ckio (hizcnt = 1) breq back a25 to a0, d31 to d0 rd, rd/wr, rasu/l, casu/l, csn, wen, bs, cke ckio (hizcnt = 0) breqh t boff2 t breqs t backd t backd t breqh t breqs t bon1 t boff1 t boff2 t bon2 t bon2 t when hzcnt = 1 when hzcnt = 0 figure 25.11 bus release timing ckio input t std t boff2 t boff1 t std t bon2 t bon1 normal mode standby mode normal mode status 0 status 1 a25 to a0, d31 to d0 rd, rd/wr, rasu/l, casu/l, csn, wen, bs, cke figure 25.12 pin driving timing in standby mode
section 25 electric al characteristics rev. 4.00 sep. 14, 2005 page 923 of 982 rej09b0023-0400 25.3.3 ac bus timing table 25.8 bus timing conditions: clock mode 2/6/7, v cc q = 3.0 v to 3.6 v, v ss q = 0 v, ta = ? 40c to + 85c b = 50 mhz * item symbol min. max. unit figure(s) address delay time 1 t ad1 1 12 ns 25.13 to 25.39 address delay time 2 t ad2 1/2t cyc 1/2t cyc + 12 ns 25.22 address delay time 3 t ad3 1/2t cyc 1/2t cyc + 12 ns 25.40, 25.41 address setup time t as 0 ? ns 25.13 to 25.18 address hold time t ah 0 ? ns 25.13 to 25.17 bs delay time t bsd ? 12 ns 25.13 to 25.36 cs delay time 1 t csd1 1 12 ns 25.13 to 25.39 cs delay time 2 t csd2 1/2t cyc 1/2t cyc + 12 ns 25.40, 25.41 read write delay time 1 t rwd1 1 12 ns 25.13 to 25.39 read write delay time 2 t rwd2 1/2t cyc 1/2t cyc + 12 ns 25.40, 25.41 read strobe delay time t rsd 1/2t cyc 1/2t cyc + 12 ns 25.13 to 25.18, 25.20 to 25.22 read data setup time 1 t rds1 1/2t cyc + 8 ? ns 25.13 to 25.18, 25.20, 25.21 read data setup time 2 t rds2 8 ? ns 25.23 to 25.26, 25.31 to 25.33 read data setup time 3 t rds3 1/2t cyc + 8 ? ns 25.22 read data setup time 4 t rds4 1/2t cyc + 8 ? ns 25.40 read data hold time 1 t rdh1 0 ? ns 25.13 to 25.18, 25.20 read data hold time 2 t rdh2 2 ? ns 25.23 to 25.26, 25.31 to 25.33 read data hold time 3 t rdh3 0 ? ns 25.22 read data hold time 4 t rdh4 1/2t cyc + 5 ? ns 25.40 write enable delay time 1 t wed1 1/2t cyc 1/2t cyc + 12 ns 25.13 to 25.18, 25.20 write enable delay time 2 t wed2 ? 12 ns 25.21
section 25 electric al characteristics rev. 4.00 sep. 14, 2005 page 924 of 982 rej09b0023-0400 b = 50 mhz * item symbol min. max. unit figure(s) write data delay time 1 t wdd1 ? 14 ns 25.13 to 25.21 write data delay time 2 t wdd2 ? 14 ns 25.27 to 25.30, 25.34 to 25.36 write data delay time 3 t wdd3 ? 1/2t cyc + 14 ns 25.40 write enable hold time 1 t wdh1 1 ? ns 25.13 to 25.21 write enable hold time 2 t wdh2 1 ? ns 25.27 to 25.30, 25.34 to 25.36 write enable hold time 3 t wdh3 1/2t cyc ? ns 25.40 wait setup time 1 t wts1 1/2t cyc + 8 ? ns 25.14, 25.15, 25.17 to 25.22 wait setup time 2 t wts2 8 ? ns 25.16 wait hold time 1 t wth1 1/2t cyc + 4 ? ns 25.14, 25.15, 25.17 to 25.22 wait hold time 2 t wth2 4 ? ns 25.16 ras delay time 1 t rasd1 1 12 ns 25.23 to 25.34, 25.36 to 25.39 ras delay time 2 t rasd2 1/2t cyc 1/2t cyc + 12 ns 25.40, 25.41 cas delay time 1 t casd1 1 12 ns 25.23 to 25.39 cas delay time 2 t casd2 1/2t cyc 1/2t cyc + 12 ns 25.40, 25.41 dqm delay time 1 t dqmd1 1 12 ns 25.23 to 25.36 dqm delay time 2 t dqmd2 1/2t cyc 1/2t cyc + 12 ns 25.40, 25.41 cke delay time 1 t cked1 1 12 ns 25.38 cke delay time 2 t cked2 1/2t cyc 1/2t cyc + 12 ns 25.41 ah delay time t ahd 1/2t cyc 1/2t cyc + 12 ns 25.18 multiplexed address delay time t mad ? 12 ns 25.18 multiplexed address hold time t mah 0 ? ns 25.18 dack , tend delay time t dacd ? refer to peripheral modules ns 25.13 to 25.34 frame delay time t fmd 1 12 ns 25.19 note: * the maximum value (f max ) of b (external bus clock) depends on the number of wait cycles and the system config uration of your board.
section 25 electric al characteristics rev. 4.00 sep. 14, 2005 page 925 of 982 rej09b0023-0400 25.3.4 basic timing t1 t ad1 t as t csd1 t2 t ad1 t rwd1 t rwd1 t csd1 t rsd t rsd t ah t rdh1 t rds1 t wed1 t wed1 t ah t bsd t bsd t dacd t dacd t wdh1 t wdd1 ckio a25 to a0 csn rd/wr rd d31 to d0 read wen bs dackn* note: * waveform for dackn when active low is selected. d31 to d0 write figure 25.13 basic bus timing for normal space (no wait)
section 25 electric al characteristics rev. 4.00 sep. 14, 2005 page 926 of 982 rej09b0023-0400 t1 t ad1 t as t csd1 tw t2 t ad1 t rwd1 t rwd1 t csd1 t rsd t rsd t ah trdh1 t rds1 t wed1 t wed1 t ah t bsd t bsd t wth1 t wts1 t dacd t dacd t wdh1 t wdd1 wait note: * waveform for dackn when active low is selected. ckio a25 to a0 csn rd/wr rd d31 to d0 read wen bs dackn* d31 to d0 write figure 25.14 basic bus timing for normal space (software 1 wait)
section 25 electric al characteristics rev. 4.00 sep. 14, 2005 page 927 of 982 rej09b0023-0400 t1 t ad1 t as t csd1 tw x t2 t ad1 t rwd1 t rwd1 t csd1 t rsd t rsd t ah t rdh1 t rds1 t wed1 t wed1 t ah t bsd t bsd t wth1 t wts1 t wth1 t wts1 t dacd t dacd t wdh1 t wdd1 wait note: * waveform for dackn when active low is selected. ckio a25 to a0 csn rd/wr rd d31 to d0 read wen bs dackn* d31 to d0 write figure 25.15 basic bus timing for normal space (one cycle of externa lly input/waitsel = 0)
section 25 electric al characteristics rev. 4.00 sep. 14, 2005 page 928 of 982 rej09b0023-0400 t1 t ad1 t as t csd1 tw x t2 t ad1 t rwd1 t rwd1 t csd1 t rsd t rsd t ah t rdh1 t rds1 t wed1 t wed1 t ah t bsd t bsd t wth2 t wts2 t wth2 t wts2 t dacd t dacd t wdh1 t wdd1 wait note: * waveform for dackn when active low is selected. ckio a25 to a0 csn rd/wr rd d31 to d0 read wen bs dackn* d31 to d0 write figure 25.16 basic bus timing for normal space (one cycle of externa lly input/waitsel = 1)
section 25 electric al characteristics rev. 4.00 sep. 14, 2005 page 929 of 982 rej09b0023-0400 t ad1 t ad1 t1 t rwd1 t rsd t wed1 t wed1 t wed1 t rds1 t rds1 t rdh1 t rdh1 t as t rsd t rsd t ah t rsd t ah t wed1 t ah t ah t csd1 t wdd1 t wdh1 t wdh1 t wdd1 t bsd t bsd t dacd t dacd t dacd t dacd t bsd t bsd t rwd1 t rwd1 t rwd1 t csd1 t csd1 t csd1 tas t ad1 t ad1 tw t2 ta w t1 tw t2 taw t wth1 t wts1 t wth1 t wts1 wait note: * waveform for dackn when active low is selected. ckio a25 to a0 csn rd/wr rd d15 to d0 read wen bs dackn* d15 to d0 write figure 25.17 basic bus timing for normal space (one cycle of software wait, external wait cycle valid (wm bit = 0), no idle cycle)
section 25 electric al characteristics rev. 4.00 sep. 14, 2005 page 930 of 982 rej09b0023-0400 ta 1 ta 2 ta 3 t1 tw tw t 2 t ad1 t csd1 t ad1 t rwd1 t rwd1 t csd1 t rsd t rsd t rds1 t wed1 t wed1 data data t bsd t bsd t wth1 t wts1 t ahd t ahd t wth1 t wts1 t dacd t dacd address t wdh1 t wdd1 t mad ckio a25 to a0 cs5b rd/wr rd ah d15 to d0 read we1 to we0 bs wait dackn* d15 to d0 write address t mah t mad t ahd note: * waveform for dackn when active low is selected. t mah t rdh1 figure 25.18 mpx-io interface bus cycle (three address cycles, one software wait cycle, one external wait cycle)
section 25 electric al characteristics rev. 4.00 sep. 14, 2005 page 931 of 982 rej09b0023-0400 tm1 t ad1 t csd1 tmd1w tmd1 t ad1 t rwd1 t fmd t wdd1 t fmd t fmd t rwd1 t csd1 ckio a25 to a0 cs6b rd/wr d31 to d0 d31 to d0 read bs frame wait wen rd write t wdh1 t wdd1 t rds2 t wdd1 t bsd t dacd t dacd t wth1 t wts1 t bsd t wdh1 t wdh1 t rdh2 note: * waveform for dackn and tendn when active low is selected. dackn, tendn* figure 25.19 burst mpx-io interf ace bus cycle single read write (one address cycle, one software wait)
section 25 electric al characteristics rev. 4.00 sep. 14, 2005 page 932 of 982 rej09b0023-0400 25.3.5 bus cycle of byte-selection sram th t ad1 t rsd t rsd t rds1 t csd1 t rwd1 t1 twx t2 tf t wdd1 t bsd t wdh1 t rdh1 t ad1 t csd1 ckio a25 to a0 csn wen rd d31 to d0 d31 to d0 read rd/wr rd/wr bs wait write t dacd t dacd t bsd t wts1 t wts1 t rwd1 t rwd1 t rwd1 t wed1 t wed1 t wth1 t wth1 dackn, tendn* note: * waveform for dackn and tendn when active low is selected. figure 25.20 byte-selectio n sram bus cycle (sw = 1 cy cle, hw = 1 cycle, one asynchronous external wait cycle, bas = 0 (write cycle ub/lb control))
section 25 electric al characteristics rev. 4.00 sep. 14, 2005 page 933 of 982 rej09b0023-0400 th t ad1 t rsd t rsd t rds1 t csd1 t1 twx t2 tf t rwd1 t wdd1 t bsd t rwd1 t rwd1 t wdh1 t rdh1 t ad1 t csd1 ckio a25 to a0 csn wen rd d31 to d0 d31 to d0 read rd/wr rd/wr bs wait dackn, tendn* note: * waveform for dackn and tendn when active low is selected. write t dacd t dacd t bsd t wts1 t wts1 t wed2 t wed2 t rwd1 t wth1 t wth1 figure 25.21 byte-selectio n sram bus cycle (sw = 1 cy cle, hw = 1 cycle, one asynchronous external wait cycle, bas = 1 (write cycle we control))
section 25 electric al characteristics rev. 4.00 sep. 14, 2005 page 934 of 982 rej09b0023-0400 25.3.6 burst rom read cycle t1 t ad1 t rsd t rds3 t rsd t csd1 t as tw tw x t 2 b tw b t2b t ad2 t ad2 t csd1 ckio a25 to a0 csn rd/wr d31 to d0 wen bs rd wait note: * waveform for dackn and tendn when active low is selected. dackn, tendn* t ad1 t bsd t dacd t dacd t bsd t rwd1 t wts1 t wts1 t rwd1 t rdh3 t rdh3 t wth1 t wth1 t rds3 figure 25.22 burst rom read cycle (one software wait cycle, one asynchrono us external burst wait cycle, two burst)
section 25 electric al characteristics rev. 4.00 sep. 14, 2005 page 935 of 982 rej09b0023-0400 25.3.7 synchronous dram timing tc1 tr tcw td1 tde t ad1 t ad1 t csd1 t ad1 t rwd1 t rwd1 t csd1 t ad1 t ad1 t ad1 t rdh2 t rds2 ckio a25 to a0 csn rd/wr a12/a11* 1 d31 to d0 t rasd1 t rasd1 rasu/l row address reada command column address t casd1 t casd1 casu/l t bsd t bsd (high) bs cke t dqmd1 t dqmd1 dqmxx t dacd t dacd dackn* 2 note: 1. an address pin to be connected to pin a10 of sdram. 2. waveform for dackn when active low is selected. figure 25.23 synchronous dram single read bus cycle (auto precharge, cas latency 2, wt rcd = 0 cycle, wtrp = 0 cycle)
section 25 electric al characteristics rev. 4.00 sep. 14, 2005 page 936 of 982 rej09b0023-0400 tr w tr tc1 tcw td1 tde tap t ad1 t ad1 t csd1 t ad1 t rwd1 t rwd1 t csd1 t ad1 t ad1 t ad1 t rdh2 t rds2 ckio a25 to a0 csn rd/wr a12/a11* 1 d31 to d0 t rasd1 t rasd1 rasu/l row address reada command column address t casd1 t casd1 casu/l t bsd t bsd (high) bs cke t dqmd1 t dqmd1 dqmxx t dacd t dacd dackn* 2 note: 1. an address pin to be connected to pin a10 of sdram. 2. waveform for dackn when active low is selected. figure 25.24 synchronous dram single read bus cycle (auto precharge, cas latency 2, wt rcd = 1 cycle, wtrp = 1 cycle)
section 25 electric al characteristics rev. 4.00 sep. 14, 2005 page 937 of 982 rej09b0023-0400 tc1 tc2 td1 td2 td3 td4 tr tc3 tc4 tde t ad1 t ad1 t csd1 t ad1 t ad1 t ad1 t ad1 t rwd1 t rwd1 t csd1 t ad1 t ad1 t ad1 t ad1 t rdh2 t rds2 ckio a25 to a0 csn rd/wr a12/a11* 1 d31 to d0 t rasd1 t rasd1 rasu/l row address reada command read command column address (1 to 4) t casd1 t casd1 casu/l t bsd t bsd (high) bs cke t dqmd1 t dqmd1 dqmxx t dacd t dacd dackn* 2 t rdh2 t rds2 note: 1. an address pin to be connected to pin a10 of sdram. 2. waveform for dackn when active low is selected. figure 25.25 synchronous dram burst read bus cycle (four read cycles) (auto precharge, cas latency 2, wt rcd = 0 cycle, wtrp = 1 cycle)
section 25 electric al characteristics rev. 4.00 sep. 14, 2005 page 938 of 982 rej09b0023-0400 tc1 tc2 td1 td2 td3 td4 tr trw tc3 tc4 tde t ad1 t ad1 t csd1 t ad1 t ad1 t ad1 t ad1 t rwd1 t rwd1 t csd1 t ad1 t ad1 t ad1 t ad1 t rdh2 t rds2 ckio a25 to a0 csn rd/wr a12/a11* 1 d31 to d0 t rasd1 t rasd1 rasu/l row address read command column address (1 to 4) t casd1 t casd1 casu/l t bsd t bsd (high) bs cke t dqmd1 t dqmd1 dqmxx t dacd t dacd dackn* 2 t rdh2 t rds2 reada command note: 1. an address pin to be connected to pin a10 of sdram. 2. waveform for dackn when active low is selected. figure 25.26 synchronous dram burst read bus cycle (four read cycles) (auto precharge, cas latency 2, wt rcd = 1 cycle, wtrp = 0 cycle)
section 25 electric al characteristics rev. 4.00 sep. 14, 2005 page 939 of 982 rej09b0023-0400 tr w l tr tc1 t ad1 t csd1 t ad1 t ad1 t rwd1 t rwd1 t rwd1 t csd1 t ad1 t ad1 t ad1 ckio a25 to a0 csn rd/wr a12/a11* 1 d31 to d0 t rasd1 t rasd1 rasu/l row address writea command column address t casd1 t casd1 casu/l t bsd t bsd (high) bs cke t dqmd1 t dqmd1 dqmxx t dacd t dacd dackn* 2 t wdh2 t wdd2 note: 1. an address pin to be connected to pin a10 of sdram. 2. waveform for dackn when active low is selected. figure 25.27 synchronous d ram single write bus cycle (auto precharge, trwl = 1 cycle)
section 25 electric al characteristics rev. 4.00 sep. 14, 2005 page 940 of 982 rej09b0023-0400 tr w t c 1 tr w l tr tr w t ad1 t csd1 t ad1 t ad1 t rwd1 t rwd1 t rwd1 t csd1 t ad1 t ad1 t ad1 ckio a25 to a0 csn rd/wr a12/a11* 1 d31 to d0 t rasd1 t rasd1 rasu/l row address writea command column address t casd1 t casd1 casu/l t bsd t bsd (high) bs cke t dqmd1 t dqmd1 dqmxx t dacd t dacd dackn* 2 t wdh2 t wdd2 note: 1. an address pin to be connected to pin a10 of sdram. 2. waveform for dackn when active low is selected. figure 25.28 synchronous d ram single write bus cycle (auto precharge, wtrcd = 2 cycles, trwl = 1 cycle)
section 25 electric al characteristics rev. 4.00 sep. 14, 2005 page 941 of 982 rej09b0023-0400 tc2 tc3 tc4 trwl tr tc1 t ad1 t csd1 t ad1 t ad1 t ad1 t ad1 t ad1 t rwd1 t rwd1 t rwd1 t csd1 t ad1 t ad1 t ad1 t ad1 ckio a25 to a0 csn rd/wr a12/a11* 1 d31 to d0 t rasd1 t rasd1 rasu/l row address writea command writ command column address t casd1 t casd1 casu/l t bsd t bsd (high) bs cke t dqmd1 t dqmd1 dqmxx t dacd t dacd dackn* 2 t wdh2 t wdd2 t wdh2 t wdd2 note: 1. an address pin to be connected to pin a10 of sdram. 2. waveform for dackn when active low is selected. figure 25.29 synchronous d ram burst write bus cycle (four write cycles) (auto precharge, wtrcd = 0 cycle, trwl = 1 cycle)
section 25 electric al characteristics rev. 4.00 sep. 14, 2005 page 942 of 982 rej09b0023-0400 tc2 tc3 tc4 trwl tr tc1 tr w t ad1 t csd1 t ad1 t ad1 t ad1 t ad1 t ad1 t rwd1 t rwd1 t rwd1 t csd1 t ad1 t ad1 t ad1 t ad1 ckio a25 to a0 csn rd/wr a12/a11* 1 d31 to d0 t rasd1 t rasd1 rasu/l row address writea command writ command column address t casd1 t casd1 casu/l t bsd t bsd (high) bs cke t dqmd1 t dqmd1 dqmxx t dacd t dacd dackn* 2 t wdh2 t wdd2 t wdh2 t wdd2 note: 1. an address pin to be connected to pin a10 of sdram. 2. waveform for dackn when active low is selected. figure 25.30 synchronous d ram burst write bus cycle (four write cycles) (auto precharge, wtrcd = 1 cycle, trwl = 1 cycle)
section 25 electric al characteristics rev. 4.00 sep. 14, 2005 page 943 of 982 rej09b0023-0400 tc3 tc4 tde tr tc2 td1 td2 td3 td4 tc1 t csd1 t ad1 t ad1 t ad1 t ad1 t ad1 t ad1 t rwd1 t rwd1 t csd1 t ad1 t ad1 t ad1 t rasd1 t rasd1 row address read command column address t casd1 t casd1 t bsd t bsd (high) t dqmd1 t dqmd1 t dacd t dacd t rdh2 t rds2 t rdh2 t rds2 ckio a25 to a0 csn rd/wr a12/a11* 1 d31 to d0 rasu/l casu/l bs cke dqmxx dackn* 2 note: 1. an address pin to be connected to pin a10 of sdram. 2. waveform for dackn when active low is selected. figure 25.31 synchronous dram burst read bus cycle (four read cycles) (bank active mode: act + read comman ds, cas latency 2, wtrcd = 0 cycle)
section 25 electric al characteristics rev. 4.00 sep. 14, 2005 page 944 of 982 rej09b0023-0400 tc2 tc4 tde tc1 tc3 td1 td2 td3 td4 t csd1 t ad1 t ad1 t ad1 t rwd1 t rwd1 t csd1 t ad1 t ad1 t rasd1 read command column address t casd1 t casd1 t bsd t bsd (high) t dqmd1 t dqmd1 t dacd t dacd t rdh2 t rds2 t rdh2 t rds2 ckio a25 to a0 csn rd/wr a12/a11* 1 d31 to d0 rasu/l casu/l bs cke dqmxx dackn* 2 note: 1. an address pin to be connected to pin a10 of sdram. 2. waveform for dackn when active low is selected. figure 25.32 synchronous dram burst read bus cycle (four read cycles) (bank active mode: read command, same row address, cas latency 2, wtrcd = 0 cycle)
section 25 electric al characteristics rev. 4.00 sep. 14, 2005 page 945 of 982 rej09b0023-0400 tc3 tc4 tde tc2 td1 td2 td3 td4 tc1 tr tr w tp t csd1 t ad1 t ad1 t ad1 t ad1 t ad1 t ad1 t rwd1 t rwd1 t rwd1 t csd1 t ad1 t ad1 t ad1 t ad1 t rasd1 t rasd1 t rasd1 t rasd1 read command column address row address t casd1 t casd1 t bsd t bsd (high) t dqmd1 t dqmd1 t dacd t dacd t rdh2 t rds2 t rdh2 t rds2 ckio a25 to a0 csn rd/wr a12/a11* 1 d31 to d0 rasu/l casu/l bs cke dqmxx dackn* 2 note: 1. an address pin to be connected to pin a10 of sdram. 2. waveform for dackn when active low is selected. figure 25.33 synchronous dram burst read bus cycle (four read cycles) (bank active mode: pre + act + read commands, different row addresses, cas latency 2, wtrcd = 0 cycle)
section 25 electric al characteristics rev. 4.00 sep. 14, 2005 page 946 of 982 rej09b0023-0400 ckio a25 to a0 csn rd/wr a12/a11* 1 d31 to d0 rasu/l casu/l bs cke dqmxx dackn* 2 note: 1. an address pin to be connected to pin a10 of sdram. 2. waveform for dackn when active low is selected. tc2 tc3 tc4 tr tc1 t ad1 t csd1 t ad1 t ad1 t ad1 t ad1 t ad1 t rwd1 t rwd1 t rwd1 t csd1 t ad1 t ad1 t ad1 t rasd1 t rasd1 row address write command column address t casd1 t casd1 t bsd t bsd (high) t dqmd1 t dqmd1 t dacd t dacd t wdh2 t wdd2 t wdh2 t wdd2 figure 25.34 synchronous dram burst write bus cycle (four write cycles) (bank active mode: act + write commands, wtrcd = 0 cycle, trwl = 0 cycle)
section 25 electric al characteristics rev. 4.00 sep. 14, 2005 page 947 of 982 rej09b0023-0400 tc2 tc3 tc4 tnop tc1 t ad1 t csd1 t ad1 t ad1 t ad1 t ad1 t rwd1 t rwd1 t rwd1 t csd1 t ad1 t ad1 t ad1 write command column address t casd1 t casd1 t bsd t bsd (high) t dqmd1 t dqmd1 t dacd t dacd t wdh2 t wdd2 t wdh2 t wdd2 ckio a25 to a0 csn rd/wr a12/a11* 1 d31 to d0 rasu/l casu/l bs cke dqmxx dackn* 2 note: 1. an address pin to be connected to pin a10 of sdram. 2. waveform for dackn when active low is selected. figure 25.35 synchronous dram burst write bus cycle (four write cycles) (bank active mode: write command, same row address, wtrcd = 0 cycle, trwl = 0 cycle)
section 25 electric al characteristics rev. 4.00 sep. 14, 2005 page 948 of 982 rej09b0023-0400 tc2 tc3 tc4 tr tpw tp tc1 t ad1 t csd1 t ad1 t ad1 t ad1 t rwd1 t rwd1 t rwd1 t rwd1 t csd1 t rasd1 t rasd1 t rasd1 t rasd1 t ad1 t ad1 t ad1 t ad1 writecommand row address t ad1 t ad1 column address t casd1 t casd1 t bsd t bsd (high) t dqmd1 t dqmd1 t dacd t dacd t wdh2 t wdd2 t wdh2 t wdd2 ckio a25 to a0 csn rd/wr a12/a11* 1 d31 to d0 rasu/l casu/l bs cke dqmxx dackn* 2 note: 1. an address pin to be connected to pin a10 of sdram. 2. waveform for dackn when active low is selected. figure 25.36 synchronous dram burst write bus cycle (four write cycles) (bank active mode: pre + act + write commands, different row addresses, wtrcd = 0 cycle, trwl = 0 cycle)
section 25 electric al characteristics rev. 4.00 sep. 14, 2005 page 949 of 982 rej09b0023-0400 tr c tr c tr r tpw tp trc t csd1 t ad1 t ad1 t rwd1 t rwd1 t rwd1 t csd1 t csd1 t csd1 t rasd1 t rasd1 t rasd1 t rasd1 t ad1 t ad1 t casd1 t casd1 (high) (hi-z)* 3 ckio a25 to a0 csn rd/wr a12/a11* 1 d31 to d0 rasu/l casu/l bs cke dqmxx dackn* 2 note: 1. an address pin to be connected to pin a10 of sdram. 2. waveform for dackn when active low is selected. 3. pins d31 to d16 with weak keeper are retained as weak keepers. figure 25.37 synchronous d ram auto-refreshing timing (wtrp = 1 cycle, wtrc = 3 cycles)
section 25 electric al characteristics rev. 4.00 sep. 14, 2005 page 950 of 982 rej09b0023-0400 tr c tr c tr c tr c tr r tpw tp t csd1 t ad1 t ad1 t rwd1 t rwd1 t rwd1 t csd1 t csd1 t csd1 t rasd1 t rasd1 t rasd1 t rasd1 t ad1 t ad1 t casd1 t casd1 (hi-z)* 3 t cked1 t cked1 ckio a25 to a0 csn rd/wr a12/a11* 1 d31 to d0 rasu/l casu/l bs cke dqmxx dackn* 2 note: 1. an address pin to be connected to pin a10 of sdram. 2. waveform for dackn when active low is selected. 3. pins d31 to d16 with weak keeper are retained as weak keepers. figure 25.38 synchronous d ram self-refreshing timing (wtrp = 1 cycle)
section 25 electric al characteristics rev. 4.00 sep. 14, 2005 page 951 of 982 rej09b0023-0400 trc trc trc tmw tde tr r tr r tpwtp trc t csd1 t ad1 t ad1 t ad1 pall ref ref mrs t rwd1 t rwd1 t rwd1 t csd1 t csd1 t csd1 t rasd1 t rasd1 t rasd1 t rasd1 t ad1 t ad1 t casd1 t casd1 (hi-z)* 3 t csd1 t csd1 t rasd1 t rasd1 t casd1 t casd1 t csd1 t csd1 t rwd1 t rwd1 t rasd1 t rasd1 t casd1 t casd1 ckio a25 to a0 csn rd/wr a12/a11* 1 d31 to d0 rasu/l casu/l bs cke dqmxx dackn* 2 note: 1. an address pin to be connected to pin a10 of sdram. 2. waveform for dackn when active low is selected. 3. pins d31 to d16 with weak keeper are retained as weak keepers. figure 25.39 synchronous dram mode register write timing (wtrp = 1 cycle)
section 25 electric al characteristics rev. 4.00 sep. 14, 2005 page 952 of 982 rej09b0023-0400 tr tc tnop trw1 tap ta p tde td1 tc tr t ad3 t ad3 ckio a25 to a0 csn rd/wr a12/a11* 1 d31 to d0 rasu/l casu/l bs cke dqmxx dackn, tendn * 2 t ad3 t ad3 t ad3 t ad3 row address column address t ad3 t ad3 t ad3 t ad3 t ad3 t ad3 t ad3 t csd2 t rwd2 t rwd2 t rwd2 t casd2 t casd2 t casd2 t casd2 t casd2 t rasd2 t rasd2 t rasd2 t rasd2 t bsd t bsd t bsd t bsd t dqmd2 t dqmd2 t dqmd2 t dqmd2 t rds4 t rdh4 t wdd3 t wdh3 t csd2 t csd2 t csd2 t dacd t dacd t dacd t dacd writea command reada command row address column address (high) (high) note: 1. an address pin to be connected to pin a10 of sdram. 2. waveform for dackn and tendn when active low is selected. figure 25.40 synchronous dram a ccess timing in low-frequency mode (auto-precharge, trwl = 2 cycles)
section 25 electric al characteristics rev. 4.00 sep. 14, 2005 page 953 of 982 rej09b0023-0400 tr c tr c tr c tr r tpw tp (hi-z)* 3 t ad3 t ad3 t csd2 t csd2 t csd2 t csd2 t casd2 t dqmd2 t casd2 t casd2 t rasd2 t cked2 t cked2 t rasd2 t rasd2 t rwd2 t rwd2 t rasd2 t ad3 t ad3 ckio a25 to a0 csn rd/wr a12/a11* 1 d31 to d0 rasu/l casu/l bs cke dqmxx dackn, tendn* 2 note: 1. an address pin to be connected to pin a10 of sdram. 2. waveform for dackn and tendn when active low is selected. 3. pins d31 to d16 with weak keeper are retained as weak keepers. figure 25.41 synchronous dram self-ref reshing timing in low-frequency mode (wtrp = 2 cycles)
section 25 electric al characteristics rev. 4.00 sep. 14, 2005 page 954 of 982 rej09b0023-0400 25.3.8 peripheral mo dule signal timing table 25.9 peripheral module signal timing conditions: v cc q = 3.0 v to 3.6 v, v cc = 1.8 v 5%, av cc = 3.0 v to 3.6 v, v ss = v ss q = av ss = 0 v, ta = ? 40c to + 85c module item symbol min. max. unit figure(s) scif input clock cycle (synchronous) 16 ? t pcyc 25.42 (asynchronous) t scyc 4 ? t pcyc 25.42 input clock rising time t sckr ? 1.5 t pcyc 25.42 input clock falling time t sckf ? 1.5 t pcyc 25.42 input clock width t sckw 0.4 0.6 t scyc 25.42 transmit data delay time (synchronous) t txd ? 3 t pcyc + 15 ns 25.43 receive data setup time (synchronous) t rxs 4 t pcyc + 15 ? ns 25.43 receive data hold time (synchronous) t rxh 100 ? ns 25.43 port output data delay time t portd ? 100 input data setup time t ports2 100 ? input data hold time t porth2 100 ? ns 25.44 dmac dreq setup time t dreq 8 ? dreq hold time t dreqh 8 ? 25.45 dack , tend delay time t dacd ? 12 ns 25.46 note: * t pcyc indicate pclock cycle. t sckw t sckr t sckf t scyc sck figure 25.42 sck input clock timing
section 25 electric al characteristics rev. 4.00 sep. 14, 2005 page 955 of 982 rej09b0023-0400 t scyc t txd sck txd (data transmission) rxd (data reception) t rxh t rxs figure 25.43 scif input/output timing in synchronous mode t ports ckio ports 7 to 0 (read) ports 7 to 0 (write) t porth t portd figure 25.44 i/o port timing t drqs t drqh ckio dreqn figure 25.45 dreq input timing ckio tend dackn t dacd t dacd figure 25.46 dack , tend output timing
section 25 electric al characteristics rev. 4.00 sep. 14, 2005 page 956 of 982 rej09b0023-0400 25.3.9 multi function timer pulse unit timing table 25.10 lists the multi function timer pulse unit timing. table 25.10 multi function timer pulse unit timing conditions: v cc = 1.8 v 5%, v cc q = av cc = 3.0 v to 3.6 v, v ss = v ss q = av ss = 0 v, ta = ? 40c to + 85c item symbol min. max. unit figure(s) output compare output delay time t tocd ? b cyc /2 + 20 ns 25.47 input capture input setup time t tics b cyc /2 + 20 ? ns timer input setup time t tcks b cyc /2 + 20 ? ns 25.48 timer clock pulse width (single edge) t tckwh/l 1.5 ? t pcyc timer clock pulse width (both edges) t tckwh/l 2.5 ? t pcyc timer clock pulse width (phase counting mode) t tckwh/l 2.5 ? t pcyc ckio output compare output input capture input t tocd t tics figure 25.47 mtu input/output timing ckio tclka to tclkd t tcks t tcks t tckwh t tckwl figure 25.48 mtu clock input timing
section 25 electric al characteristics rev. 4.00 sep. 14, 2005 page 957 of 982 rej09b0023-0400 25.3.10 poe module signal timing table 25.11 output enable (poe) timing conditions: v cc = 1.8 v 5%, v cc q = av cc = 3.0 v to 3.6 v, v ss = v ss q = av ss = 0 v, ta = ? 40c to + 85c item symbol min. max. unit figure(s) poe input setup time t poes b cyc /2+10 ? ns 25.49 poe input pulse width t poew 1.5 ? t pcyc ckio poen input t poes t poew figure 25.49 poe input/output timing
section 25 electric al characteristics rev. 4.00 sep. 14, 2005 page 958 of 982 rej09b0023-0400 25.3.11 i 2 c module signal timing table 25.12 i 2 c bus interface timing normal conditions: v cc = 1.8 v 5%, av cc = v cc q = 3.0 v to 3.6 v, v ss = av ss = v ss q = 0 v, ta = ? 40c to + 85c specifications item symbol test conditions min. typ. max. unit figure(s) scl input cycle time t scl 12 t pcyc + 600 ? ? ns 25.50 scl input high pulse width t sclh 3 t pcyc + 300 ? ? ns scl input low pulse width t scll 5 t pcyc + 300 ? ? ns scl, sda input rising time t sr ? ? 300 ns scl, sda input falling time t sf ? ? 300 ns scl, sda input spike pulse removal time * 2 t sp ? ? 1.2 t pcyc * 1 sda input bus free time t buf 5 t pcyc ? ? t pcyc start condition input hold time t stah 3 t pcyc ? ? t pcyc retransmit start condition input setup time t stas 3 t pcyc ? ? t pcyc stop condition input setup time t stos 3 t pcyc ? ? t pcyc data input setup time t sdas 1 t pcyc + 20 ? ? ns data input hold time t sdah 0 ? ? ns scl, sda capacitive load cb 0 ? 400 pf scl, sda output falling time t sf v cc q = 3.0 to 3.6 v ? ? 250 * 3 ns note: 1. pcyc indicates peripheral clock cycle. 2. depends on the value of the register nf2cyc. 3. indicates the i/o buffer characteristic.
section 25 electric al characteristics rev. 4.00 sep. 14, 2005 page 959 of 982 rej09b0023-0400 scl v ih v il t stah t buf p* s* t sf t sr t scl t sdah t sclh t scll sda sr* t stas t sp t stos t sdas p* [legend] s: start condition p: stop condition sr: start condition for retransmission figure 25.50 i 2 c bus interface input/output timing
section 25 electric al characteristics rev. 4.00 sep. 14, 2005 page 960 of 982 rej09b0023-0400 25.3.12 h-udi related pin timing table 25.13 h-udi related pin timing conditions: v cc q = 3.0 v to 3.6 v, v cc = 1.8 v 5%, av cc = 3.0 v to 3.6 v, v ss = v ss q = av ss = 0 v, ta = ? 40c to + 85c item symbol min. max. unit figure(s) tck cycle time t tckcyc 50 ? ns 25.51 tck high pulse width t tckh 0.4 0.6 ttckcyc tck low pulse width t tckl 0.4 0.6 ttckcyc trst setup time t trsts 20 ? ns 25.52 trst hold time t trsth 50 ? t cyc tdi setup time t tdis 10 ? ns 25.53 tdi hold time t tdih 10 ? ns tms setup time t tmss 10 ? ns tms hold time t tmsh 10 ? ns tdo delay time t tdod ? 20 ns capture register setup time t capts 10 ? ns 25.54 capture register hold time t capth 10 ? ns update register delay time t updted ? 16 ns t tckcyc v ih 1/2 v cc q 1/2 v cc q v ih v il v il v ih t tckl t tckf t tckf t tckh figure 25.51 tck input timing
section 25 electric al characteristics rev. 4.00 sep. 14, 2005 page 961 of 982 rej09b0023-0400 t trsts t trsth trst r esetp figure 25.52 trst input timing (reset-hold state) tck tms tdi tdo when boundary scan is not performed when boundary scan is performed t tdis t tdih t tckcyc t tmss t tmsh t tdod t tdod figure 25.53 h-udi data transfer timing tck capture register update register t updated t capth t capts figure 25.54 boundary-scan input/output timing
section 25 electric al characteristics rev. 4.00 sep. 14, 2005 page 962 of 982 rej09b0023-0400 25.3.13 usb module signal timing table 25.14 usb module clock timing conditions: v cc = 1.8 v 5%, v cc q = 3.0 v to 3.6 v, av cc = 3.0 v to 3.6 v, v ss = v ss q = av ss = 0 v, ta = ? 40c to + 85c item symbol min. max. unit figure(s) frequency (48 mhz) t freq 47.9 48.1 mhz 25.55 clock rising time t ras ? 4 ns clock falling time t fas ? 4 ns duty cycle (t high /t low ) t duty 90 110 % t high t low t freq 10% t ras t fas 90% uclk figure 25.55 usb clock timing
section 25 electric al characteristics rev. 4.00 sep. 14, 2005 page 963 of 982 rej09b0023-0400 25.3.14 usb transceiver timing table 25.15 usb transceiver timing conditions: v cc = 1.8 v 5%, v cc q = 3.0 v to 3.6 v, av cc = 3.0 v to 3.6 v, v ss = v ss q = av ss = 0 v, ta = ? 40c to + 85c item symbol min. typ. max. unit test conditions rising time t r 4 ? 20 ns c l = 50pf falling time t f 4 ? 20 ns c l = 50pf rising/falling time ratio t r /t f 90 ? 110 % output crossover voltage v crs 1.3 ? 2.0 v c l = 50pf output driver resistance z dru 28 44 ? notes: 1. transceivers conform to the full-speed specification. 2. the resistance includes the value of the externally connected resistor (rs = 27 ? 1%). t r , t f 90% 10% dp crossover voltage 1. the values of t r and t f are measured at 10% and 90% of amplitude. 2. the capacitance ( c l ) includes stray capacitance of writing connection and probe input capacitance. notes: dm vccq dp dm vssq r l = 27 ? c l c l r l = 27 ? device to be measured measurement circuit
section 25 electric al characteristics rev. 4.00 sep. 14, 2005 page 964 of 982 rej09b0023-0400 25.3.15 ac characteristics measurement conditions ? i/o signal reference level: v cc q/2 (v cc q = 3.0 to 3.6 v, v cc = 1.8 v 5%) ? input pulse level: v ss q to 3.0 v (where resetp , resetm , asemd0 , nmi, trst , extal, ckio, tck, md0, md2, md3, and schmitt inputs are within v ss q to v cc q) ? input rising and falling times: 1 ns i ol i oh c l v ref lsi output pin dut output notes: c l is the total value that includes the capacitance of measurement tools. each pin is set as follows: 30pf: ckio, rasu/l, casu/l, cs0, cs2 to cs6b, and back 50pf: all other pins i ol and i oh are shown in table 25.4. 1. 2. figure 25.56 output load circuit
section 25 electric al characteristics rev. 4.00 sep. 14, 2005 page 965 of 982 rej09b0023-0400 25.4 a/d converter characteristics table 25.16 lists the a/d converter characteristics. table 25.16 a/d converter characteristics conditions: v cc q = 3.0 to 3.6 v, v cc = 1.8 v 5%, av cc = 2.7 v to 3.6 v, v ss q = v ss = av ss = 0 v, ta = ? 40c to + 85c item min. typ. max. unit resolution 10 10 10 bits conversion time ? ? 10.5 s analog input capacitance ? ? 20 * 1 pf permissible signal-source impedance (single-source) ? ? 5 * 1 k ? nonlinearity error ? ? 3.0 * 1 lsb offset error ? ? 2.5 * 1 lsb full-scale error ? ? 2.5 * 1 lsb quantization error ? ? 0.5 * 1 lsb cks1 = 0, cks0 = 0 * 2 ? ? 8.0 lsb absolute accuracy (p = 33 mhz) other than above ? ? 4.0 notes: 1. reference values 2. the fastest conversion time is equivalent to 4.4 us.
section 25 electric al characteristics rev. 4.00 sep. 14, 2005 page 966 of 982 rej09b0023-0400
appendix rev. 4.00 sep. 14, 2005 page 967 of 982 rej09b0023-0400 appendix a. pin states a.1 when other function is selected table a.1 pin states in reset state, power down mode, and bus-released states when other function is selected reset state power down mode type pin name power-on manual software standby sleep bus- released reset clock extal (clock modes 2 and 6) i i i i i extal (clock mode 7) z * 1 z * 1 z * 1 z * 1 z * 1 extal (clock modes 2 and 6) o o o o o extal (clock mode 7) o * 1 o * 1 o * 1 o * 1 o * 1 extal (clock modes 2 and 6) o o o/z * 2 o o/z * 2 extal (clock mode 7) i i i i i ckio2 o o o/z * 2 o o/z * 2 system control resetp resetm i i i i i breq z+ i+ z+ i+ i+ back z+ o z+ o l md[3,2,0] i i * 5 i * 5 i * 5 i * 5 status[1:0] z+ o o o o interrupt irq[7:0] z+ i+ i+ i+ i+ nmi i i i i i address a[25:19], a0 z+ o o/z+ * 3 o z+ * 6 bus a[18:1] o o o/z * 3 o z
appendix rev. 4.00 sep. 14, 2005 page 968 of 982 rej09b0023-0400 reset state power down mode type pin name power-on manual software standby sleep bus- released reset data bus d[15:0] z i z i z d[31:16] z+ i+ z+ i+ z+ * 6 bus control cs0 h o z/h * 3 o z cs6[a,b] cs5[a,b] cs[2:4] z+ o z+/h * 3 o z+ bs h o z/h * 3 o z cas[u,l] ras[u,l] z+ o o/z+ * 2 o o/z+ * 2 * 6 we0 /dqmll we1 /dqmlu we2 /dqmul we3 /dqmuu/ ah h o z/h * 3 o z rd/ wr rd h o z/h * 3 o z cke z+ o o/z+ * 2 o o/z+ * 2 * 6 wait z i++ z i++ z frame z+ o z+/h * 3 o z+ dmac dreq[1:0] z+ i+ z+ i+ i+ dack[1:0] z+ o o/z+ * 4 o o tend z+ o o/z+* 4 o o mtu tclk[a:d] z+ i+ z+ i+ i+ tioc0[a:d] z+ i+/o z+/k * 4 i+/o i+/o tioc1[a,b] z+ i+/o z+/k * 4 i+/o i+/o tioc2[a,b] z+ i+/o z+/k * 4 i+/o i+/o tioc3[a:d] z+ i+/o z+/k * 4 i+/o i+/o tioc4[a:d] z+ i+/o z+/k * 4 i+/o i+/o poe poe[3:0] z+ i+ z+ i+ i+
appendix rev. 4.00 sep. 14, 2005 page 969 of 982 rej09b0023-0400 reset state power down mode type pin name power-on manual software standby sleep bus- released reset scif[2:0] rxd[2:0] z+ i+ z+ i+ i+ txd[2:0] z+ o/z+ o/z+ * 4 o/z+ o/z+ sck[2:0] z+ i+/o k/z+ * 4 i+/o i+/o rts[2:0] z+ i+/o k/z+ * 4 i+/o i+/o cts[2:0] z+ i+/o k/z+ * 4 i+/o i+/o aud audsync z+ o o o o audck o o o o o audata[3:0] z+ o o o o h-udi * 8 asebrkak o o o o o asemd0 i i * 5 i * 5 i * 5 i * 5 tck i++ i++ i++ i++ i++ tdi i++ i++ i++ i++ i++ tms i++ i++ i++ i++ i++ trst i++ i++ i++ i++ i++ tdo o/z * 7 o/z* 7 o/z* 7 o/z* 7 o/z* 7 usb txdmns txdpls z+ o o/z+ * 4 o o dmns dpls vbus z+ i+ i+ i+ i+ suspnd txenl z+ o o/z+ * 4 o o xvdata uclk z+ i+ i+ i+ i+ dp dm z i/o i i/o i/o a/d an[7:0] z i z i i iic2 scl sda z i/o z i/o i/o
appendix rev. 4.00 sep. 14, 2005 page 970 of 982 rej09b0023-0400 [legend] i: input i+: input with weak keeper i++: input with pull-up mos o: output l: low level output h: high level output z: hi-z (the pin must not be open since the inte rmediate level at this pin caused a pass though current in the lsi.) z+: hi-z with weak keeper z++: hi-z with pull-up mos k: input becomes hi-z, output retains state notes: 1. the extal pin must be pul led up and the xtal pin must be open. 2. controlled by the hizcnt bit in the common control register of the bsc. 3. controlled by the hizmem bit in the common control register of the bsc. 4. controlled by the hiz bit in the standby control register. 5. the pin must not be open since the inte rmediate level at this pin causes the path though current in the lsi. 6. the data register of the i/o port can be written to. 7. hi-z when the tap controller of the h-udi is neither shift-dr nor shift-ir state. 8. when the h-udi is not used, pins asemd0 , tck, tdi, and tms must be pulled up, the tdo and asebrkak pins must be open, and the trst pin must be connected to the resetp pin or ground. for use of emulators, the board must be desi gned following instructions in the emulator manual.
appendix rev. 4.00 sep. 14, 2005 page 971 of 982 rej09b0023-0400 a.2 when i/o port is selected table a.2 pin states in reset state, power down mode, and bus-released states when i/o port is selected reset state power down mode pin name power-on manual software standby sleep bus-released reset pta[14:0] z+ i+/o z+/k * i+/o i+/o ptb[8:0] z+ i+/o z+/k * i+/o i+/o ptc[15,14,12:0] z+ i+/o z+/k * i+/o i+/o ptc[13] o i+/o z+/k * i+/o i+/o ptd[15:0] z+ i+/o z+/k * i+/o i+/o pte[15:0] z+ i+/o z+/k * i+/o i+/o ptf[15:0] z+ i+/o z+/k * i+/o i+/o ptg[13:11,8] z+ i+/o z+/k * i+/o i+/o ptg[10:9] z i/o z+/k * i/o i/o ptg[7:0] z i z i i pth[14:0] z+ i+/o z+/k * i+/o i+/o ptj[12:0] z+ i+/o z+/k * i+/o i+/o [legend] i: input i+: input with weak keeper o: output z: hi-z (the pin must not be open since the interm ediate level at this pin causes a path though current in the lsi.) z+: hi-z with weak keeper k: input becomes hi-z, output retains state note: * controlled by the hiz bit in the standby control register.
appendix rev. 4.00 sep. 14, 2005 page 972 of 982 rej09b0023-0400 b. product lineup product model package (code) SH7641 hd6417641bp100 (100 mhz version) p-lfbga1717-256 * note: * for details of packages, please contac t your nearest renesas technology sales representative.
appendix rev. 4.00 sep. 14, 2005 page 973 of 982 rej09b0023-0400 c. package dimensions package code jedec jeita p-lfbga-1717-256 ? ? 0.35 to 0.45 0.20 0.15 c c 0.15 (4 ) c 1.40 max 0.08 0.15 0.44 to 0.64 (256 ) m c m c a b 0.80 b a a1 corner 20 19 a b c d e f g h j k l m n p r t u v w y 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 15.20 17.00 0.05 0.80 15.20 17.00 0.05 figure c.1 package dimensions
appendix rev. 4.00 sep. 14, 2005 page 974 of 982 rej09b0023-0400
rev. 4.00 sep. 14, 2005 page 975 of 982 rej09b0023-0400 main revisions and add itions in this edition item page revisions (s ee manual for details) general precautions on handling of product iv 5. added. section 9 exception handling 9.5 note on initializing this lsi 217 ; mov.w #h'ff40,r10; mov.l #h'a4fc0000,r8; mov #h'10,r9; mov.b r10,@r10; mov.b r10,@r10; mov.b r10,@r10; mov.l r9,@r8; ; mov.l #h'fc000000,r1; mov.w @r1,r0; ; mov #h'00,r9; mov.b r10,@r10; mov.b r10,@r10; mov.b r10,@r10; section 13 direct memory access controller (dmac) 13.4.8 notes on dreq sampling when dack is divided in external access 446 added.
rev. 4.00 sep. 14, 2005 page 976 of 982 rej09b0023-0400 item page revisions (s ee manual for details) section 25 electrical characteristics figure 25.37 synchronous dram auto-refreshing timing (wtrp = 1 cycle, wtrc = 3 cycles) figure 25.38 synchronous dram self-refreshing timing (wtrp = 1 cycle) figure 25.39 synchronous dram mode register write timing (wtrp = 1 cycle) figure 25.41 synchronous dram self-refreshing timing in low-frequency mode (wtrp = 2 cycles) 949 to 951 and 953 (hi-z)* 3 d31 to d0 note: 1. an address pin to be connected to pin a10 of sdram. 2. waveform for dackn when active low is selected. 3. pins d31 to d16 with weak keeper are retained as weak keepers.
rev. 4.00 sep. 14, 2005 page 977 of 982 rej09b0023-0400 index numerics 16-bit/32-bit di splacement....................... 47 a a/d conversion time............................... 810 a/d converter ......................................... 797 a/d converter characteristics................ 965 absolute addresses ................................... 46 absolute maximum ratings ................... 907 access wait control................................. 329 acknowledge .......................................... 489 address array.................................. 180, 190 address map ........................................... 275 address multiplexing.............................. 339 addressing modes..................................... 48 a-field....................................................... 64 alu fixed-point operations...................... 99 alu integer operations .......................... 104 alu logical op erations........................... 105 area division........................................... 273 arithmetic operation instructions ............. 73 auto-refreshing....................................... 365 auto-request mode ................................. 426 b b-field....................................................... 65 bit synchronous circuit ........................... 507 boundary scan ........................................ 471 branch instructions ................................... 77 buffer operation...................................... 571 burst mode.............................................. 438 burst mpx-i/o interface ........................ 382 burst rom interface....................... 376, 386 burst rom read cycle .......................... 934 bus arbitration ........................................ 399 bus cycle of byte-selection sram....... 932 bus state controller ........................................ 146 bus state controller................................ 269 byte-selection sram interface .............. 377 c cache ...................................................... 179 cascaded operation ................................. 574 clock frequency control circuit............... 145 clock operating modes ........................... 146 clock pulse generator ............................. 143 clock synchronous serial format............. 497 compare match ....................................... 564 compare match timer.............................. 509 compare matches.................................... 514 complementary pwm mode .................. 591 control registers........................................ 31 control transfer ....................................... 768 cpu........................................................... 25 cpu address error ................................... 206 cpu core instructions ............................... 44 crystal osc illator ..................................... 145 csn assert period expansion ................... 331 cycle-steal mode..................................... 436 d data alignment ........................................ 321 data array........................................ 181, 190 data formats.............................................. 42 data size.................................................... 44 data transfer instructions .......................... 71 data transfer operation............................ 118 dc characteristics .................................. 910 deep sleep mode ..................................... 163 delayed branching .................................... 45
rev. 4.00 sep. 14, 2005 page 978 of 982 rej09b0023-0400 direct memory access controller.......... 405 divider.................................................... 145 dma address error ................................. 209 dsp addressing....................................... 124 dsp data instructions................................ 84 dsp operation..................................... 88, 99 dsp registers ............................................ 35 dual address mode.................................. 433 e endian..................................................... 321 ep1 bulk-out transfer........................... 774 ep2 bulk-in transfer............................... 776 ep3 interrupt-in transfer ........................ 778 example of usb external circuitry......... 786 exception code ....................................... 200 exception handling ................................. 197 external request mode .................... 426, 438 f fixed mode ............................................. 429 fixed-point multiply operation ............... 107 free-running counter .............................. 562 free-running counters............................. 563 full-scale error........................................ 813 g general registers ....................................... 29 global base register .................................. 25 h high-impedance state ............................. 673 i i/o buffer with open drain output ........... 841 i/o buffer with weak keeper ................... 841 i/o ports .................................................. 843 i 2 c bus format ....................................... 488 i 2 c bus interface 2................................... 473 illegal general instruction exception ....... 207 illegal slot in struction ............................. 207 immediate data.......................................... 46 input capture ........................................... 566 input/output timing ................................. 619 instruction formats .............................. 58, 61 interrupt controller.................................. 219 interrupt excepti on handling ................... 235 interrupt signal timing ............................ 624 interval timer mode................................. 161 irq interrupts ......................................... 233 l list of registers ...................................... 865 load/store architecture.............................. 45 local data move instruction.................... 122 logic operation instructions ..................... 75 lru ........................................................ 181 m manual-on reset ...................................... 165 mode 2 .................................................... 147 mode 6 .................................................... 147 mode 7 .................................................... 147 module st andby....................................... 174 module standby function ........................ 174 modulo addressing............................ 54, 135 modulo register......................................... 25 most significant bit detection operation.. 112 mpx-i/o interface .................................. 332 multi mode.............................................. 806 multi-function timer pul se unit ....... 517, 833
rev. 4.00 sep. 14, 2005 page 979 of 982 rej09b0023-0400 multiply and accumulate high register ..... 26 multiply and accumulate low register....... 26 multiply/multiply-and-accumulate operations ................................................. 45 n nmi interrupt.......................................... 233 noise canceler......................................... 501 nonlinearity error ................................... 813 normal space interface ........................... 324 o offset error ............................................. 813 on-chip peripheral module interrupts ........... 234 on-chip peripheral module request......... 428 operand conflict ..................................... 123 operation in asynch ronous mode ........... 723 overflow protection................................ 117 p periodic counter...................................... 562 phase counting mode .............................. 581 pin function co ntroller ............................ 819 pll circuit 1........................................... 145 pll circuit 2........................................... 145 power-down modes ................................ 163 power-on reset ........................................ 164 power-on sequence ............................... 908 priority............................................ 202, 235 procedure register ..................................... 26 processing of usb standard commands . 779 program counter ....................................... 26 pwm mode............................................. 576 q quantization error ................................... 813 r register adcr ................................................. 804 adcsr ............................................... 801 addr ................................................. 800 bamra.............................................. 244 bamrb .............................................. 247 bara ................................................. 243 barb.................................................. 246 bbra.................................................. 244 bbrb.................................................. 249 bdmrb .............................................. 248 bdrb.................................................. 247 betr .................................................. 254 brcr.................................................. 251 brdr.................................................. 255 brsr .................................................. 254 ccr1 .................................................. 182 ccr2 .................................................. 183 chcr.................................................. 410 cmcnt .............................................. 512 cmcor .............................................. 512 cmcsr............................................... 511 cmncr .............................................. 278 cmstr............................................... 510 csbcr................................................ 281 cswcr .............................................. 286 dar.................................................... 409 dmaor.............................................. 416 dmars .............................................. 421 dmatcr ........................................... 409 expevt ..................................... 199, 201 frqcr ............................................... 149 iccr1 ................................................. 476 iccr2 ......................................... 47 9, 508 icdrr ................................................ 487
rev. 4.00 sep. 14, 2005 page 980 of 982 rej09b0023-0400 icdrs ................................................ 487 icdrt ................................................ 487 icier.................................................. 482 icmr.................................................. 480 icr ..................................................... 225 icsr ................................................... 484 icsr1 ................................................. 675 imcr.................................................. 231 imr .................................................... 229 intevt2............................................ 201 ipr...................................................... 223 irr ..................................................... 228 nf2cyc............................................. 487 ocsr.................................................. 679 pacr.................................................. 824 padr ................................................. 844 pbcr.................................................. 826 pbdr.................................................. 846 pccr.................................................. 827 pcdr.................................................. 848 pdcr.................................................. 828 pddr ................................................. 850 pecr .................................................. 830 pedr.................................................. 852 peior ................................................ 832 pemturwer ................................... 833 pfcr .................................................. 834 pfdr .................................................. 854 pgcr.................................................. 836 pgdr ................................................. 857 phcr.................................................. 838 phdr ................................................. 861 pjcr................................................... 839 pjdr................................................... 863 rtcnt ............................................... 319 rtcor............................................... 319 rtcsr ............................................... 317 rwtcnt ........................................... 320 sar (dmac)..................................... 409 sar (iic2) ......................................... 486 scbrr ............................................... 707 scfcr................................................ 714 scfdr................................................ 717 scfrdr ............................................. 690 scfsr ................................................ 699 scftdr ............................................. 691 sclsr ................................................ 720 scrsr................................................ 690 scscr................................................ 695 scsmr ............................................... 691 scsptr.............................................. 717 sctsr ................................................ 690 sdbpr................................................ 457 sdbsr................................................ 458 sdcr.................................................. 314 sdidh ................................................ 467 sdidl................................................. 467 sdir ................................................... 457 stbcr................................................ 166 tcbr.................................................. 561 tcdr.................................................. 561 tcnt.................................................. 553 tcnts................................................ 561 tcr..................................................... 524 tddr ................................................. 561 tgcr.................................................. 559 tgr .................................................... 553 tier ................................................... 548 tior ................................................... 530 tmdr................................................. 528 tocr.................................................. 557 toer.................................................. 556 tra .................................................... 198 tsr ..................................................... 550 tstr................................................... 554 tsyr .................................................. 554 usbctrl .......................................... 765 usbdasts ........................................ 760 usbdmar......................................... 762 usbepdr .......................................... 757
rev. 4.00 sep. 14, 2005 page 981 of 982 rej09b0023-0400 usbepdr0i ....................................... 756 usbepdr0o ...................................... 756 usbepdr0s....................................... 757 usbepstl......................................... 763 usbepsz0o ....................................... 758 usbepsz1 ......................................... 759 usbfclr .......................................... 761 usbier.............................................. 754 usbifr .............................................. 750 usbisr .............................................. 753 usbtrg ............................................ 759 usbxvercr .................................... 764 wtcnt .............................................. 156 wtcsr .............................................. 157 register addresses ................................. 866 register bits ........................................... 876 repeat end register ................................... 25 repeat start register .................................. 25 reset-synchronized pwm mode ............ 588 rounding operation ................................ 115 round-robin mode.................................. 430 s saved program counter ............................. 25 saved status register ................................. 25 scan mode .............................................. 808 sdram interface ................................... 335 self-refreshing ........................................ 366 serial communication interface with fifo ................................................................ 685 shadow area............................................ 274 shift instructions....................................... 76 shift opera tions....................................... 109 single address mode ............................... 434 single data addressing .............................. 53 single mode ............................................ 805 slave address .......................................... 489 sleep mode ..................................... 163, 171 software standby mode........................... 163 stall operations ....................................... 780 standby control circuit............................ 145 standby mode ......................................... 172 start cond ition......................................... 489 status register............................................ 25 stop cond ition ......................................... 489 synchronous dram timing .................. 935 synchronous operation.................... 568, 733 system control instructions....................... 78 system registers ........................................ 35 t t bit .......................................................... 45 tap controller ........................................ 468 u u memory ............................................... 451 unconditional trap .................................. 208 usb bus power control method .............. 789 usb function module ............................. 747 user break controller............................... 241 user break point trap............................... 208 user debugging interface ........................ 455 v vector base register................................... 25 w wait between access cycles .................... 387 watchdog timer....................................... 155 watchdog timer mode............................. 160
rev. 4.00 sep. 14, 2005 page 982 of 982 rej09b0023-0400 x x/y data addressing.................................. 52 x/y memory ........................................... 193
renesas 32-bit risc microcomputer hardware manual SH7641 publication date: rev.1.00 sep 19, 2003 rev.4.00 sep 14, 2005 published by: sales strategic planning div. renesas technology corp. edited by: customer support department global strategic communication div. renesas solutions corp. ? 2005. renesas technology corp., all rights reserved. printed in japan.
sales strategic planning div. nippon bldg., 2-6-2, ohte-machi, chiyoda-ku, tokyo 100-0004, japan http://www.renesas.com refer to "http://www.renesas.com/en/network" for the latest and detailed information. renesas technology america, inc. 450 holger way, san jose, ca 95134-1368, u.s.a tel: <1> (408) 382-7500, fax: <1> (408) 382-7501 renesas technology europe limited dukes meadow, millboard road, bourne end, buckinghamshire, sl8 5fh, united kingdom tel: <44> (1628) 585-100, fax: <44> (1628) 585-900 renesas technology hong kong ltd. 7th floor, north tower, world finance centre, harbour city, 1 canton road, tsimshatsui, kowloon, hong kong tel: <852> 2265-6688, fax: <852> 2730-6071 renesas technology taiwan co., ltd. 10th floor, no.99, fushing north road, taipei, taiwan tel: <886> (2) 2715-2888, fax: <886> (2) 2713-2999 renesas technology (shanghai) co., ltd. unit2607 ruijing building, no.205 maoming road (s), shanghai 200020, china tel: <86> (21) 6472-1001, fax: <86> (21) 6415-2952 renesas technology singapore pte. ltd. 1 harbour front avenue, #06-10, keppel bay tower, singapore 098632 tel: <65> 6213-0200, fax: <65> 6278-8001 renesas technology korea co., ltd. kukje center bldg. 18th fl., 191, 2-ka, hangang-ro, yongsan-ku, seoul 140-702, korea tel: <82> 2-796-3115, fax: <82> 2-796-2145 renesas technology malaysia sdn. bhd. unit 906, block b, menara amcorp, amcorp trade centre, no.18, jalan persiaran barat, 46050 petaling jaya, selangor darul ehsan, malaysia tel: <603> 7955-9390, fax: <603> 7955-9510 renesas sales offices colophon 3.0

SH7641 hardware manual


▲Up To Search▲   

 
Price & Availability of SH7641

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X